Michael Prewecki
Michael Prewecki

Reputation: 2102

Modify the Status of CRM case using OData web service

Using "XRMServices/2011/OrganizationData.svc" oData end point in a C# client is it possible to modify the Status of a CRM case (Incident in schema terms)?

The following code works fine using the Organisation service

            var setStateRequest = new SetStateRequest
            {
                EntityMoniker = new Microsoft.Xrm.Sdk.EntityReference("incident", caseGuid),
                State = new Microsoft.Xrm.Sdk.OptionSetValue(state),
                Status = new Microsoft.Xrm.Sdk.OptionSetValue(status)
            };
            organizationServiceProxy.Execute(setStateRequest);

Is there equivalent functionality available through the Organisation data service?

Upvotes: 1

Views: 291

Answers (1)

Andrew Butenko
Andrew Butenko

Reputation: 5456

If you develop for CRM 2015 SP1 or higher that something like

//pseudocode
var case = {
StateCode : {Value: 1},
StatusCode : {Value: -1}
};
OrgDataService.Update("incident", incidentid, case);

will work because special fields (like statecode, statuscode, owner, e.t.c.) became available for update operations - https://msdn.microsoft.com/en-us/library/gg309589(v=crm.7).aspx#BKMK_updateop

But if you develop for CRM 2011/2013/2015 you will have to use Organization.svc and Soap.

Upvotes: 2

Related Questions