The process to set the state and status of a Custom Entity within your plugin code is slighlty different to when setting it for an out of the box system type in CRM 4.0.
You need to use the SetStateDynamicEntityRequest and SetStateDynamicEntityResponse classes rather than the predefined ones like SetStateAccountRequest.
You just define which type of custom entity you are setting the state for and its Unique Identifier (GUID).
SetStateDynamicEntityRequest stateReq = new SetStateDynamicEntityRequest();
stateReq.Entity = new Moniker();
stateReq.Entity.Id = new Guid("The GUID of your Entity instance here
stateReq.Entity.Name = "
//Set to Inactive
stateReq.State = "inactive";
stateReq.Status = -1;
//Set to Active
//stateReq.State = "active";
//stateReq.Status = 1;
SetStateDynamicEntityResponse stateSet = SetStateDynamicEntityResponse)crmService.Execute(stateReq);
Thursday, 10 July 2008
Set the State/Status of A Custom Entity in CRM 4.0
Posted by Catherine at 4:31 PM
Labels: Microsoft CRM 4.0
Subscribe to:
Post Comments (Atom)




1 comments:
Thanks, handy tip!
Post a Comment