This message is not included in common messages file i.e. Sdk.Soap.vsdoc.js. They provided a separate file, the Sdk.SetState.vsdoc.js to incorporate this message. To use this file we need to slightly change the existing code. We need to add the following line as the first line of the Sdk.SetState.vsdoc.js file,

Sdk = window.Sdk || { __namespace: true };

And we need to include two files at entity form load event:

Sdk.Soap.vsdoc.js

Sdk.SetState.vsdoc.js

Now, we are all set to use the following method.

function jQuerySetStateActivateRecord() {

//Use the GUID value of contact record

var contactMoniker = new Sdk.EntityReference("contact", "GUID");

var setStateRequest = new Sdk.SetStateRequest(contactMoniker, 0, 1);

//To deactivate record, use same code just pass state = 1 and status = 2) at above line

Sdk.Sync.execute(setStateRequest);

alert("Contcat Activated.");

}

I hope this would be helpful. In my upcoming post, I will be covering the sample code for Sdk.JQ and Sdk.Q namespaces.

if (context.InputParameters.Contains("EntityMoniker")&& context.InputParameters.Contains("State") && ((OptionSetValue)context.InputParameters["State"]).Value == 1 && ((OptionSetValue)context.InputParameters["Status"]).Value == 4) {---------------------------------------------------------------------So, I tried to set the state of my entiry record using XRMServiceToolKit as below

About Me

Ankit Shah is highly motivated and experienced professional, Bachelor Science in Information Technology -B.Sc. (I.T.) securing more than 8 years of IT experience on software design and development.
Presently Ankit is working as a Dynamics CRM consultant at Inkey Solutions, Surat, India.