Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanmichaeljames/29b0665c370f0a9e849791fdf84c41cc to your computer and use it in GitHub Desktop.
Save ryanmichaeljames/29b0665c370f0a9e849791fdf84c41cc to your computer and use it in GitHub Desktop.
Retrieve operation with Xrm.WebApi.online.executeMultiple
var Sdk = window.Sdk || {};
/**
* Request to update a record
* @param {Object} entityReference - The entity reference.
* @param {Array} columns - The columns.
*/
Sdk.RetrieveRequest = function (entityReference, columns) {
this.entityReference = entityTypeName;
this.columns = columns;
this.getMetadata = function () {
return {
boundParameter: null,
parameterTypes: {},
operationType: 2,
operationName: "Retrieve",
};
};
};
// Construct a request object array from the metadata
var requests = [
new Sdk.RetrieveRequest({ etn: "new_entity", id: "00000000-0000-0000-0000-000000000000" }, ["new_name"]),
new Sdk.RetrieveRequest({ etn: "new_entity", id: "00000000-0000-0000-0000-000000000000" }, ["new_name"])
];
// Use the request object array to execute the function
Xrm.WebApi.online.executeMultiple(requests).then(
(result) => {
if (result.ok) {
console.log(`${result.status} ${result.statusText}`);
}
},
(error) => {
console.log(error.message);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment