formData.saveAsync
(FintechOS Studio 21.1.0 and later)
Saves the currently displayed form or form driven flow.
Syntax
Copy
function formData.saveAsync(options?: ISaveOptions): Promise<any>;
| Parameter | Type | Description |
|---|---|---|
options
|
ISaveOptions | Options to skip Before Save and After Save scripts for wizard-based forms (which are executed by default when the record is saved). |
The promise result includes information such as the ID of the saved record or if the save was successful, for example:
Copy
{
ClientScript: null,
ErrorCode: 0,
Id: "ff41b9bf-1506-42b4-a518-1121b9d0250a",
IsSuccess: true,
Message: "Record updated",
Serialized: "{\"Id\":\"ff41b9bf-1506-42b4-a518-1121b9d0250a\",\"Message\":\"Record updated\",\"IsSuccess...,
UIResult: null
}
Type Aliases
Copy
{
skipAfterSaveScript?: boolean;
skipBeforeSaveScript?: boolean;
}
| Property | Type | Description |
|---|---|---|
skipAfterSaveScript (optional) |
boolean | Set to true to not execute the After Save script when the record is saved (in wizard-based forms). |
skipBeforeSaveScript (optional) |
boolean | Set to true to not execute the Before Save script when the record is saved (in wizard-based forms). |
Examples
In this example:
- We create an event handler that saves the currently displayed form when clicking the saveRecord custom button.
- We use the ebs.showMessage method to display feedback, depending if the save was successful or not.
Copy
$('#saveRecord').on('click', function (event) {
formData.saveAsync().then(function (e) {
if (e.IsSuccess) {
ebs.showMessage('Record ' + e.Id + ' has been saved successfully.')
} else {
ebs.showMessage('Record save failed', 'error')
}
})
});