JavaScript > JavaScript for Acrobat API Reference > JavaScript API > Data > Data methods > setFieldValue

Type conversion is performed when setting field values. The type conversion is determined by the collectionField in the schema. When attempting to set a field value that is not defined in the schema, an exception is raised.
The value of the field, or null if field is not present in schema.
Get and set field values of the first data object in this collection.
var d = this.dataObjects[0];
d.setFieldValue("subject", "New laptop!", "RE: ");
// Now get the same field value we just set. Here s = "RE: New laptop!"
var s = d.getFieldValue({ name:"subject", includePrefix:true });
// Get the same field value, with includePrefix set to false, the default
// Now the value of s is "New laptop!".
s = d.getFieldValue("subject");
// Sets subject to "A. C. Robat" and clears prefix
d.setFieldValue("subject", "A. C. Robat");