In
Dynamics 365 version it is very easy to retrieve the entity record in JavaScript
is quite simple and not requires writing multiple lines of code.
On success it returns a promise containing a JSON object with
the retrieved columns and their values.
Here
a basic retrieve example-
Retrieves the name and revenue of an account record with
record ID = 5531d753-95af-e711-a94e-000d3a11e605.
Xrm.WebApi.retrieveRecord("account", "a8a19cdd-88df-e311-b8e5-6c3be5a8b200", "?$select=name,revenue").then(
function success(result) {
console.log("Retrieved values: Name: " + result.name + ", Revenue: " + result.revenue);
// perform
operations on record retrieval
},
function (error) {
console.log(error.message);
// handle error
conditions
}
);
The above example displays the following in your console; you
might see other values depending on your data:
Retrieved
values: Name: Sample Account, Revenue: 5000000
Reference:
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webapi/retrieverecord
No comments:
Post a Comment