Change the Status using SetStateRequest in c# mscrm
SetStateRequest state = new SetStateRequest();
state.EntityMoniker = new EntityReference(context.PrimaryEntityName, context.PrimaryEntityId);
state.State = new OptionSetValue(0);//(0);//0=active
state.Status = new OptionSetValue(StatusCode);//(621260000);//=cancelled;//(1)=active
// Point the Request to the case whose state is being changed
// Execute the Request
_tracing.Trace("state.State" + state.State + "state.Status " + state.Status);
SetStateResponse stateSet = (SetStateResponse)_service.Execute(state);
state.EntityMoniker = new EntityReference(context.PrimaryEntityName, context.PrimaryEntityId);
state.State = new OptionSetValue(0);//(0);//0=active
state.Status = new OptionSetValue(StatusCode);//(621260000);//=cancelled;//(1)=active
// Point the Request to the case whose state is being changed
// Execute the Request
_tracing.Trace("state.State" + state.State + "state.Status " + state.Status);
SetStateResponse stateSet = (SetStateResponse)_service.Execute(state);
Comments
Post a Comment