Close custom activity entity

MarkascompleteAre you looking to close your custom entity using SDK, then this post is for you. We can close ms crm custom activity type entity like other entities using SetStateRequest message.  You can use below code for the same


public void CompleteTextMessage()
IOrganizationService _CrmService = GetCRMService(); //a function to return ms crm service object
SetStateRequest _SetStateReq = new SetStateRequest();
//provide entity details
SetStateReq.EntityMoniker = new EntityReference(“your custom entity logical name”, new Guid(“CustomEntityID”));
// Set the State and Status OptionSet Values to completed.
SetStateReq.State = new OptionSetValue(1);
SetStateReq.Status = new OptionSetValue(2);
// call execute message by passing request object
SetStateResponse _SetStateResp = (SetStateResponse)_CrmService.Execute(SetStateReq);

Leave a comment

Filed under MS CRM 2011

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s