Home > MS CRM 4.0 > Re -Open Closed Activity

Re -Open Closed Activity

This morning i got question from one of my client as below

”  Is there any way to re-open closed activity like activating record that has been De-activated “. I never thought that this option not exists in CRM by default but for my wonder it is. After digging bit in the SDK  i get know that i can change state of any record using “SetStateRequest”. So i wrote small script where it sets the status of the Activity to open  .I added this script as part of ISV menu in activity (Task) entity.

ISV.Config XML

 <Entity name=”task”>
     <ToolBar ValidForCreate=”0″ ValidForUpdate=”1″>
      <Button Icon=”/_imgs/ico_16_exportCustomizations.gif” JavaScript=” if(crmForm.FormType==4){ var xml = ” + ‘&lt;?xml version=\’1.0\’ encoding=\’utf-8\’?&gt;’ + ‘&lt;soap:Envelope xmlns:soap=\’http://schemas.xmlsoap.org/soap/envelope/\’ xmlns:xsi=\’http://www.w3.org/2001/XMLSchema-instance\’ xmlns:xsd=\’http://www.w3.org/2001/XMLSchema\’&gt;’ + GenerateAuthenticationHeader() + ‘ &lt;soap:Body&gt;’ + ‘ &lt;Execute xmlns=\’http://schemas.microsoft.com/crm/2007/WebServices\’&gt;’ + ‘ &lt;Request xsi:type=\’SetStateTaskRequest\’&gt;’ + ‘ &lt;EntityId&gt;’+crmForm.ObjectId+’&lt;/EntityId&gt;’ + ‘ &lt;TaskState&gt;Open&lt;/TaskState&gt;’ + ‘ &lt;TaskStatus&gt;-1&lt;/TaskStatus&gt;’ + ‘ &lt;/Request&gt;’ + ‘ &lt;/Execute&gt;’ + ‘ &lt;/soap:Body&gt;’ + ‘&lt;/soap:Envelope&gt;’ + ”; var xmlHttpRequest = new ActiveXObject(‘Msxml2.XMLHTTP’); xmlHttpRequest.Open(‘POST’,’/mscrmservices/2007/CrmService.asmx’, false); xmlHttpRequest.setRequestHeader(‘SOAPAction’,’http://schemas.microsoft.com/crm/2007/WebServices/Execute&#8217;); xmlHttpRequest.setRequestHeader(‘Content-Type’, ‘text/xml; charset=utf-8’); xmlHttpRequest.setRequestHeader(‘Content-Length’, xml.length); xmlHttpRequest.send(xml); var resultXml = xmlHttpRequest.responseXML; window.location.reload();}”>
        <Title LCID=”1033″ Text=”Re-Open Activity” />
        <ToolTip LCID=”1033″ Text=”Re-Opens the activity if it is closed.” />

Categories: MS CRM 4.0
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: