Revision: 57998
Updated Code
at June 20, 2012 16:15 by toLL
Updated Code
// 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 var setStateRequest = new SetStateRequest(); setStateRequest.EntityMoniker = new EntityReference(record.LogicalName, record.Id); // State property corresponds to the StateCode of an Entity. Its' shown as the Status in CRM setStateRequest.State = new OptionSetValue((int)new_entityState.Inactive); // 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 setStateRequest.Status = new OptionSetValue(-1); var response = (SetStateResponse)service.Execute(setStateRequest);
Revision: 57997
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 20, 2012 16:13 by toLL
Initial Code
// Refer http://msdn.microsoft.com/en-us/library/ms914670.aspx // for SateCode's (Status) and StatusCode's (Status Reason) IOrganizationService service; new_entity record; // a record of new_entity, can be any Entity var setStateRequest = new SetStateRequest(); setStateRequest.EntityMoniker = new EntityReference(record.LogicalName, record.Id); // State property corresponds to the StateCode of an Entity. Its' shown as the Status in CRM setStateRequest.State = new OptionSetValue((int)new_entityState.Inactive); // 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 setStateRequest.Status = new OptionSetValue(-1); var response = (SetStateResponse)service.Execute(setStateRequest);
Initial URL
Initial Description
How to change Entity StateCode (Status) using SetStateRequest
Initial Title
CRM 2011: Set EntityState using SetStateRequest
Initial Tags
Initial Language
C#