Dela via


Xrm.Page.data (client-side reference)

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

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

    Name

    Type

    Required

    Description

    save

    Boolean

    No

    true if the data should be saved after it is refreshed, otherwise false.

    successCallback

    Function

    No

    A function to call when the operation succeeds.

    errorCallback

    Function

    No

    A function to call when the operation fails.

    An object with the following properties will be passed:

    • errorCode: Number. The error code.

    • message: 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.

With Microsoft Dynamics CRM Online 2015 Update 1 or later you can also set an object to control how appointment, recurring appointment, or service activity records are processed.

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

    Name

    Type

    Required

    Description

    saveOptions

    Object

    No

    With Microsoft Dynamics CRM Online 2015 Update 1 or later the object passed can indicate whether to use the Book or Reschedule messages rather than the Create or Update messages.

    This option is only applicable when used with appointment, recurring appointment, or service activity records.

    If you wish to apply these options, pass the following object as this parameter:

    { UseSchedulingEngine: true}
    

    successCallback

    Function

    No

    A function to call when the operation succeeds. No parameters are passed to this function.

    errorCallback

    Function

    No

    A function to call when the operation fails.

    An object with the following properties will be passed:

    • errorCode: Number. The error code.

    • message: 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 365 forms
Use the Xrm.Page object model

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright