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.
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. |
Note
Unsure about entity vs. table? See Developers: Understand terminology in Microsoft Dataverse.
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);
}