Edit

Share via


formContext.data.save (Client API reference)

Saves the record asynchronously with the option to set callback functions to be executed after the save operation is completed.

You can also set an object to control how appointment, recurring appointment, or service activity records are processed.

Syntax

formContext.data.save(saveOptions).then(successCallback, errorCallback);

Parameters

Name Type Required Description
saveOptions Object No An object for specifying options for saving the record. The object has following parameters:

- saveMode: (Optional) Number. Specify a value indicating how the save event was initiated. For a list of supported values, see the return value of the getSaveMode method. Note that setting the saveMode does not actually take the corresponding action; it is just to provide information to the OnSave event handlers about the reason for the save operation.

- useSchedulingEngine: (Optional) Boolean. Indicate whether to use the Book or Reschedule messages rather than the Create or Update messages. This option is only applicable when used with appointment, recurring appointment, or service activity records.

NOTE: useSchedulingEngine property is not supported in Unified Interface.
successCallback Function No A function to call when the operation succeeds.
errorCallback Function No A function to call when the operation fails. An object with the following properties will be passed:

- errorCode: Number. The error code.

- message: String. A localized error message.

Note

When working with forms, and you call the formContext.data.save method, make sure that you also call the preventDefault to ensure that any default save operation is not triggered when a user saves the form.

formContext.data.entity.save
formContext