Reactivate Case in CRM 2011


Hi,

Below the minimum rights required to Reactivate a closed or resolved Case in CRM.

Sample code to do it through code


private void Form_Load(object sender, EventArgs e)
 {
 Uri organizationUri = new Uri("http://servername/orgname/XRMServices/2011/Organization.svc");
 Uri homeRealmUri = null;
 ClientCredentials credentials = new ClientCredentials();
 credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
 OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
 IOrganizationService _service = (IOrganizationService)orgProxy;
 ReactivateState("incident", new Guid("caseGuid"), 0, -1, _service);
 }

public static void ReactivateState(string entityName, Guid entityGuid, int state, int status, IOrganizationService orgService)
 {
 try
 {
 SetStateRequest req = new SetStateRequest();
 req.EntityMoniker = new EntityReference(entityName, entityGuid);
 req.State = new OptionSetValue(state);
 req.Status = new OptionSetValue(status);
 orgService.Execute(req);
 }
 catch (Exception ex)
 {

 }
 }

Bye.

Advertisements

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

Please share your thoughts

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

WordPress.com Logo

You are commenting using your WordPress.com 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.