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.

Important:

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

  1. 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 
    
                  
  2. 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 
    
                  
  3. The ‘update_custom’ Attribute must be specified.

                        var attribute = {
            name  : 'update_custom',
            value : "1"
        } 
    
                  
  4. Call NSOA.wsapi.modify(attributes, objects).

                        var projResults = NSOA.wsapi.modify([attribute], [recProj]); 
    
                  
  5. Check for any errors, see Handling SOAP Errors.

  6. Process the results, see UpdateResult.