Notifications
Announcements
No record found.
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,
Hi,
please share your code
If you have a promise, use the then function:
insertRecord().then(
(onResolved) => {
// retrieve record..
},
(onRejected) => {
// Some task on failure
}
)
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!
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 70 Super User 2025 Season 2
Gerardo RenterÃa Ga... 33 Most Valuable Professional
Daniyal Khaleel 32 Most Valuable Professional