Xrm.Page.data (client-side reference)

 

Applies To: Dynamics CRM 2013

Xrm.Page.data provides methods to work with the form. You can refresh the data in the form and save the form asynchronously.

Xrm.Page.data properties and methods

  • refresh
    Asynchronously refreshes and optionally saves all the data of the form without reloading the page.

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

refresh

Asynchronously refreshes and optionally saves all the data of the form without reloading the page.

Xrm.Page.data.refresh(save).then(successCallback, errorCallback);
  • Parameters

    • save
      A Boolean value to indicate if data should be saved after it is refreshed.

    • successCallback
      A function to call when the operation succeeds.

    • errorCallback
      A function to call when the operation fails.

      The errorCallback will be passed an object with the following properties:

      • errorCode
        Type: Number. The error code.

      • message
        Type: String. A localized error message.

  • Remarks
    This method is only available for Updated entities.

save

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

Xrm.Page.data.save().then(successCallback, errorCallback)
  • Parameters
    The successCallback and errorCallback functions are executed depending on whether an error is returned.

    The successCallback will not have any arguments passed to it. It will simply be called if the operation succeeds.

    The errorCallback will be passed an object with the following properties:

    • errorCode
      Type: Number. The error code.

    • message
      Type: String. A localized error message.

  • Remarks
    This method is only available for Updated entities.

See Also

Client-side programming reference
Form scripting quick reference
Xrm.Page.data.entity (client-side reference)
Xrm.Page.data.entity attribute (client-side reference)
Write code for Microsoft Dynamics CRM 2013 forms
Use the Xrm.Page object model