All transmissions

24 June 2018

Status Change using WebApi

CRM OnlineDynamics 365WebApi

In Dynamics 365, OOTB status field value can be changed in many different ways.

Following WebApi can be used to update the Status (statecode + statuscode) as follows.

changeStatus = function (executionContext, entityLogicalName, recordId, statecode, statuscode) {
// Remove brackets from the GUID if there’s any
var id = recordId.replace(“{“, “”).replace(“}”, “”);
// Set statecode and statuscode
var data = {
“statecode”: statecode,
“statuscode”: statuscode
};
// WebApi call
Xrm.WebApi.updateRecord(entityLogicalName, id, data).then(function  success(result) {
executionContext.getFormContext().data.refresh(true);
}, function (error) {
executionContext.getFormContext().data.refresh(true);
});
};

CRMFortress logoCRMFortress

A Microsoft-focused consulting practice. We run the cloud estate, harden the security and build the Power Platform and SharePoint solutions that let your teams work without friction.

Managed IT · Cloud · Power Platform

The stack we run

Microsoft AzurePower AppsPower AutomatePower BISharePointMicrosoft 365Dataverse

© 2026 CRMFortress. IT that holds under pressure.

Engineered in Australia