Neil McDonald's Dynamics CRM Blog

Posts Tagged ‘workflows

Cross Browser Support For Calling Workflow Via Ribbon Buttons

with 2 comments

For some time now, I’ve been using ribbon buttons to call various workflows, both from open records and subgrids. There’s a good guide here on how to do this, but like most guides, they were written before update rollup 12 was released. Since cross-browser support was introduced in UR12, I’ve found that the ribbon buttons do not work unless I’m using Internet Explorer.

After looking at the JavaScript code again, I could see why it was failing (snippet below)

var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"\" xmlns:xsi=\"\" xmlns:xsd=\"\">" +
Xrm.Page.context.getAuthenticationHeader() +
"<soap:Body>" +
"<Execute xmlns=\"\">" +
"<Request xsi:type=\"ExecuteWorkflowRequest\">" +
"<EntityId>" + guid + "</EntityId>" + //entity record ID
"<WorkflowId>" + workflowId + "</WorkflowId>" + //WorkflowId - guid of the workflow
"</Request>" +
"</Execute>" +
"</soap:Body>" +

var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

The XMLHttpRequest is being created using ActiveX, which is only supported by Internet Explorer.

Simply changing the affected code to the below has fixed the issue and it now works across all browsers.

var xmlHttpRequest = new XMLHttpRequest();"POST", "/mscrmservices/2007/CrmService.asmx", false);

Note: The change on the second line may not be obvious, but .open has been changed to use a lower case O

Written by neilmcd

March 27, 2013 at 5:17 pm

Send mass mailings using templates

with one comment

Campaigns with Dynamics CRM are a great way to communicate with your customers and leads, but for some reason, Microsoft left out the option of sending campaign emails using email templates. There is, as always, a workaround for this. You can send the email template via an on demand workflow against a list of contacts.

First of all create your email template for the entity you would like to send the email to. In this case, I am going to use the Contact entity.


Read the rest of this entry »

Written by neilmcd

August 2, 2010 at 3:13 pm

Posted in CRM 4

Tagged with , ,