Good day,
In Javascript, how to call 2 functions but in turn. the 2nd function must be executed after 1st function completed.
So I have a function to insert a new record, then 2nd function is to retrieve the record. Guess by just calling it in 2 lines not working
Regards,
You can see below example of CRM XRM functions for creating and retrieving data using JavaScript.
Xrm.WebApi.createRecord("entityName", Your Query").then(
function success(result)
{
Xrm.WebApi.retrieveRecord("entityName ", "Your Query").then(
function success(result)
{
console.log("deleted");
// perform operations on record deletion
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
Hope this helps.
Thanks!
If you have a promise, use the then function:
insertRecord().then(
(onResolved) => {
// retrieve record..
},
(onRejected) => {
// Some task on failure
}
)
Hi,
please share your code
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156