/
JavaScript onSave Functions

JavaScript onSave Functions


You use the JavaScript onSave code to set the value of fields or to trigger creating another object. The onSave functions include the following:

  • fieldsOnDefault. Sets the values in fields. Values are either read directly from a parent object and inserted in a child object, or a conditional query is run to determine the value that to set.
  • getDefaultValueOfMEFIELDNAME. You use getDefaultValueOfMEFIELDNAME in conjunction with fieldsOnDefault to set a value in the field specified in MEFIELDNAME. Using the getDefaultValueOfMEFIELDNAME function, you also enter the conditional query being used to determine the value that must be written.
  • fieldsOnSave. Defines which fields are read if performing a query for the onSave function. For example, to create a new record if the status field is set to Complete, then define the status field using the fieldsOnSave function.
  • onSave. If using the fieldsOnSave function, then you must also include an onSave action. You cannot save values to fields using onSave. You must use onSave with the MELT command to display a message or create a new record.