/ Published in: C#
How to change Entity StateCode (Status) using SetStateRequest
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Refer http://msdn.microsoft.com/en-us/library/ms914670.aspx // for StateCode's (Status) and StatusCode's (Status Reason) IOrganizationService service; new_entity record; // a record of new_entity, can be any Entity // State property corresponds to the StateCode of an Entity. Its' shown as the Status in CRM // Status property corresponds to the StatusCode of an Entity. Its' shown as the StatusReason in CRM // set this value to -1 to let the system automatically set the appropiate corresponding status value var response = (SetStateResponse)service.Execute(setStateRequest);