Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 2.33 KB

File metadata and controls

69 lines (49 loc) · 2.33 KB
title description author ms.author ms.date ms.reviewer ms.topic applies_to search.audienceType contributors
PostSave Event (Client API reference) in model-driven apps| MicrosoftDocs
Information about PostSave event methods.
HemantGaur
hemantg
09/15/2022
jdaly
reference
Dynamics 365 (online)
developer
JimDaly

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.

[!INCLUDE cc_book-instead-of-save]

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.

[!INCLUDEcc-terminology]

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

getEntityReference
getIsSaveSuccess
getSaveErrorInfo

[!INCLUDEfooter-include]