Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The purpose and usage of the method is identical to the underlying API provided by Microsoft, the only addition is the retry logic.

Enreach.API.Xrm.execute

(Available from v1.5.2 on)

Executes a request (e.g. an action) against Dynamics API.

...

Example code to execute a WhoAmIRequest in a custom plugin:

Code Block
languagejs
var SampleCustomer = SampleCustomer || {};
SampleCustomer.Plugins = SampleCustomer.Plugins || {};

SampleCustomer.Plugins.whoAmI = async function (context) {
    var requestData = {};

    var metadata = {
        boundParameter: null,
        parameterTypes: {},
        operationType: 1, // This is a function. Use '0' for actions and '2' for CRUD
        operationName: "WhoAmI",
    };

    var response = await Enreach.API.Xrm.execute(requestData, metadata);
    console.log("Your user id is " + response.UserId);
};