Updating Custom Fields
For NSOA.wsapi functions, the name of the custom field is the Field name defined for the custom field with the special ‘__c’ suffix appended to identify it as a custom field. It is also necessary to explicitly enable custom field updating.
It is not possible to rename, change, or delete a custom field which is being used by an active script. This prevents unintended script problems.
To update a custom field
-
Create an OpenAir record object with the NSOA.record.<complex type>( [id] ), NSOA.form.getNewRecord() or NSOA.form.getOldRecord() functions.
var updProj = NSOA.form.getNewRecord(); // Get the record to modify var recProj = new NSOA.record.oaProject(); // Record to specify only the values to update recProj.id = updProj.id; // We need the ID to update the correct record
-
Use the correct name format for the custom field, that is Field name defined for the custom field + ‘__c’.
recProj.ReviewDate__c = '2014-01-16'; // Notice the date format YYYY-MM-DD
-
The ‘update_custom’ Attribute must be specified.
var attribute = { name : 'update_custom', value : "1" }
-
Call NSOA.wsapi.modify(attributes, objects).
var projResults = NSOA.wsapi.modify([attribute], [recProj]);
-
Check for any errors, see Handling SOAP Errors.
-
Process the results, see UpdateResult.