Generating/Rendering a PDF from a sql reporting services report – CRM 4

Posted by on Dec 9, 2010 in CRM 4.0, SQL Reporting Services |

sounds simple dosen’t it – my objective is to run an estimate report and render to PDF all from the click of a button as shown in the screenshot below:

Heres the code —

Deploy aspx to CRM ISV folder — create ISV button to call the ASPX page passing the oppID parameter (being the actual opportunityid) to the page.

Read More

Call/Request a workflow in CRM 4.0 using Javascript

Posted by on May 25, 2009 in CRM 4.0, Customizations, JavaScript |

  1. Add a button on Form’s Toolbar/Grid’s Menu Bar for the entity in ISV config file (export ISV config)
  2. Call launchOnDemandWorkflowForm (for button on Form) or launchOnDemandWorkflow (for button on grid) functions and pass the parameters sGrid, iObjType and workflowId.
  3. Save the config file and import it to CRM.

An example of this could be:

<Entity name="account">
<ToolBar ValidForCreate="0" ValidForUpdate="1">
<Button Icon="/_imgs/mybutton.jpg" JavaScript="launchOnDemandWorkflowForm('', '10029','{00000000-0000-0000-0000-000000-00000}');" PassParams="1" WinParams="" WinMode="0">
<Title LCID="1033" Text="Send Email" />
<ToolTip LCID="1033" Text="Send Welcome Email" />

Or you can alternatively request it from the web service:

/* the function */
ExecuteWorkflow = function(entityId, workflowId)
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"\" xmlns:xsi=\"\" xmlns:xsd=\"\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <Execute xmlns=\"\">" +
" <Request xsi:type=\"ExecuteWorkflowRequest\">" +
" <EntityId>" + entityId + "</EntityId>" +
" <WorkflowId>" + workflowId + "</WorkflowId>" +
" </Request>" +
" </Execute>" +
" </soap:Body>" +
"</soap:Envelope>" +
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
var resultXml = xmlHttpRequest.responseXML;

// call the workflow
var theWorkflowId = "3FD2DD58-4708-43D7-A21B-F0F90A0AA9F2"; //change to your workflow Id
ExecuteWorkflow(crmForm.ObjectId, theWorkflowId);

Read More

Add a Button to a Form

Posted by on May 23, 2009 in CRM 4.0, Customizations, JavaScript |

This post is to show how to add a Button to a MS CRM Form, not to the Navigation Pane nor to the Menu Bar, but to the actual Form itself.
In this post I will show a simple usage of the Button, to show its function. You can understand that more advanced functions can be triggered by the button, but that’s not the aim of this post.For this example I have used the default Contact Form. The Address Section is hidden onLoad and a Button is shown.

Button on Form

By Clicking on the Button the Section with the Address Details is shown again. In this example the Button Disappears, because it has no use anymore. (I could have added a function to hide the section again).

Button on Form2

To achieve the above I have created a new Section with a new Attribute (new_button).

Button on Form3

Next to that I placed the following Script in the onLoad of the Form:

Update: 9th March 2010 – updated code blocks – wordpress broke the code!

Read More

Hiding Sidebar Navigation (Related Entities)

Posted by on Sep 18, 2008 in CRM 4.0, Customizations, JavaScript |

Hi Guys,

Recently for a client, we had to create some many-to-1 relationship from Contact to Accounts & Opportunities.  We then had the problem of the related entity navigation on the side showing up.  They didn’t want to see all these related navigations. I added some onLoad code on the contact form to hide the Sidebar navigation.


The key is to get the relationship Elementid from the source code of the page (Press Ctrl + N to open new window, then click on the ‘view’ menu and click ’source’). Then find the Name of the Navigation and find the element id:

onLoad code:

document.getElementById("nav_new_contact_account_dm1").style.display = "none";
document.getElementById("nav_new_contact_account_dm2").style.display = "none";
document.getElementById("nav_new_contact_account_dm3").style.display = "none";
document.getElementById("nav_new_contact_account_dm4").style.display = "none";
document.getElementById("nav_new_contact_opportunity_dm1").style.display = "none";
document.getElementById("nav_new_contact_opportunity_dm2").style.display = "none";
document.getElementById("nav_new_contact_opportunity_dm3").style.display = "none";
document.getElementById("nav_new_contact_opportunity_dm4").style.display = "none";


I hope this helps you all and gives you some idea of how powerful JavaScript & CRM are.

-MSCRM Person

Read More
%d bloggers like this: