Reading Custom Fields
Use the Form Schema to find the correct field name for the custom field.
![Example of custom field as shown in the Scripting Studio form schema explorer.](img/UserScripting/CustomFields_4.png)
You can read the custom field value and label in the same way as for standard fields.
// Read the date value and log the value if the date is not empty
function logReviewDate(){
var reviewDate = NSOA.form.getValue('ReviewDate__c');
if( reviewDate !== null ) {
NSOA.meta.alert(reviewDate.toString());
}
}
Note:
The old approach to reading custom fields using custom_
with the internally assigned custom field number appended is d. Use the custom fields name followed by __c
(underscore underscore c) instead.
// Supported but NOT RECOMMENDED
var reviewDate = NSOA.form.getValue('custom_15');
}
To read a custom field value using record functions
-
Create an OpenAir record object with the NSOA.record.<complex type>( [id] ), NSOA.form.getNewRecord() or NSOA.form.getOldRecord() functions.
var proj = NSOA.form.getOldRecord(); // Call on 'After save' event
-
The custom field name is the Field name defined for the custom field with the special ā__cā suffix appended to identify it as a custom field.
// custom field name = 'ReviewDate' + '__c';
-
Use the name to access the custom field value in the record object.
var reviewDate = proj.ReviewDate__c;
See also Updating Custom Fields.