/
JavaScript onPreSave Functions
JavaScript onPreSave Functions
JavaScript onPreSave code is entered into the onSave action, and it must include the following functions as part of the code:
- fieldsOnPreSave. Defines which fields to read, either from the current object or a parent object, to perform a conditional query against.
- onPreSave. Names the individual fields. If running a conditional query to determine the value to write to a field, then the conditional query must also be entered using the onPreSave function.
- onPreSaveJSON. The Save and Save and New buttons appear for modules in the client application when editing or creating records. When a user selects either of these buttons, the onPreSaveJSON function is called. You can configure the onPreSaveJSON function in any module that has the Save and Save and New buttons, and onPreSaveJSON will be called before the record is saved. You use the onPreSaveJSON function for data validation, and to either allow or prevent record saving.
- onSaveJSON. The Save and Save and New buttons appear for modules in the client application when editing or creating records. When a user selects either of these buttons, the onSaveJSON function is called. You can configure the onSaveJSON function in any module that has the Save and Save and New button, and onSaveJSON will be called after the record is saved.