Hi,
I want to update 'statuscode' & 'statecode' of accounts.
Can anybody suggest me?
*This post is locked for comments
Hi,
I want to update 'statuscode' & 'statecode' of accounts.
Can anybody suggest me?
*This post is locked for comments
Hi Patel,
Below is the sample code to deactivate accounts. Similarly, you can use different statecode and statuscode based on your business needs.
For accounts:
State |
Status Reason |
---|---|
0 : Active |
1 : Active |
1 : Inactive |
2 : Inactive |
var entity = {}; entity.statuscode = 2; entity.statecode = 1; var req = new XMLHttpRequest(); req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v8.1/accounts(0000000-0000-0000-0000-000000000000)", true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 204) { } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(JSON.stringify(entity));
Hope it helps!
Hi,
there is a sample javascript function in this thread (ReactivateCase):
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,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156