PostSave Event
PostSave event occurs after the OnSave event is complete. This event is used to support or execute custom logic using web resources to perform after Save actions when the save event is successful or failed due to server errors.
Note
The OnSave event for appointment, recurring appointment, or service activity records will cancel the save operation and use the Book message to persist the change rather than Create or Update. Because of this, OnSave and PostSave event handlers for these tables will not work.
Use the addOnPostSave and removeOnPostSave methods to manage event handlers for this event.
Note
This method is supported only on Unified Interface
Syntax
formContext.data.entity.addOnPostSave(myFunction)
Parameter
| Name | Type | Required | Description |
|---|---|---|---|
| myFunction | function reference | Yes | The function to add to the PostSave event. The execution context is automatically passed as the first parameter to this function. |
Example
The following sample code displays organization unique name as form notification.
function addMessageToOnPostSave(executionContext) {
var formContext = executionContext.getFormContext();
formContext.data.entity.addOnPostSave(displayOrgName);
}
// function to display organization unique name.
function displayOrgName(executionContext)
{
var formContext = executionContext.getFormContext();
var orgName = Xrm.Utility.getGlobalContext().organizationSettings.uniqueName;
var myuniqueId = "_myUniqueId";
formContext.ui.setFormNotification(orgName, "INFO", myuniqueId);
window.setTimeout(function () { formContext.ui.clearFormNotification(myUniqueId); }, 10000);
}
Relates articles
Feedback
Submit and view feedback for