Show no. of open or closed activities (history) on the CRM form.

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

Hello all,

Have you ever wanted to see the total no. of outstanding/completed activities on a Case, Account, Opportunity, Contact etc..?  

Well now you can, simply add the following JavaScript code to the onLoad event of the entity, it will query the webservice and it will give you the exact count of open/closed activities.

Update: 9th March 2010 – I have updated the code below and tested.

Any comments or suggestions are welcome!

Read More

Add custom toolbar buttons to the Case Entity form.

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

Hi All,

Have you ever wanted to add some toolbar buttons to the CASE/CONTACT/ACCOUNT form?

Well now you can, you can use the ISV.config provided by CRM.

  1. Export the ISV Config Customizations from CRM
  2. Edit the XML file
  3. Find the <entity name=”incident”> node and add the following – I couldn’t paste the XML because of wordpress limitations.

  4. Note: the following are custom images: taskicon.gif, emailicon.gif and phonecallicon.gif.

  5.  Save the XML and import into CRM and publish the customizations.

Code explantion:

JavaScript="locAddActTo(4210)" PassParams="0" WinParams="" WinMode="0" Client="Web, Outlook" AvailableOffline="true"

Here we are using the CRM javascript function locAddActTo() and using the entity identifier (this being a phone call) which is located in the SDK and we are telling CRM to show this button is Outlook and the web version of CRM

JavaScript="resolve();" PassParams="0" WinParams="" WinMode="0" Client="Web, Outlook" AvailableOffline="true"

We are using the resolve() function on the case entity form which will resolve the case like you would when going to the actions menu > resolve case

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

JavaScript Web Service Call

Posted by on Aug 12, 2008 in CRM 4.0, Customizations, JavaScript, SDK |

Firstly i’d like to thank Michael Höhne for his great application that converts your c# code to Javascript. Basically you input your c# code and it sends a soap request and gets a reply and converts the request to Javascript so you can do it in realtime and not by a plug-in.

  • First grab the application from:
  • Open the project Visual Studio and double click on Form1.cs
  • Go to the “try” line and input your c# code to be converted.
  • Below i have my peice of code which just queries the systemuser entity for the GUID: F2EBE1D4-8E57-DD11-9225-000C29165D7E

  • Build the program and run the Application (from the bin\deubg dir)
  • Click on the start and wait until you see a response in the response tab.
  • Then move onto the Javascript tab and copy the code and paste it on a event (onchange, onload & onsave)
  • Heres my final code:
function RetrieveXML()
var xml = "" +
"" +
"" +
GenerateAuthenticationHeader() +
" " +
" " +
" " +
" systemuser" +
" " +
" " +
" businessunitid" +
" " +
" " +
" false" +
" " +
" And" +
" " +
" " +
" systemuserid" +
" Equal" +
" " +
" "+crmForm.all.ownerid.DataValue[0].id+"" +
" " +
" " +
" " +
" " +
" " +
" " +
" " +
"" +
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;
var businessUnitName = resultXml.getElementsByTagName("q1:businessunitid")[0].getAttribute('name');

  • Basically this gets the businessunit name from the ownerid in the field.

Hope this helps.

Read More

lookup field – onchange event

Posted by on Aug 12, 2008 in Customizations, JavaScript |

Hi Guys,

I have noticed that sometimes onchange code for a lookup needs some time (1sec) than to run its code.

Heres an example of a 1 second wait (wait until the lookup is populated with the lookup id, name etc):

window.setTimeout(getDetails, 1000);

function getDetails()
if(crmForm.all.ownerid.DataValue[0].id != null)
// do something

Read More

Welcome to

Posted by on Aug 12, 2008 in CRM 4.0, Customizations, Deployment, General, JavaScript, Licensing, Plug-ins, SDK |

Hi Guys,

Welcome to my new Blog. My name is Ibrahim Sukari (refer to the About Me page for more info), i am a CRM developer. The company i work for is called RightServ. We have done quiet a few CRM deployments with hefty customizations. I basically created this blog to give back to the community that indeed helped me during those tough deployments. I’ll be posting a range of stuff including code and how-to’s. I want this blog to be on top and become a ALL-IN-ONE resource for Microsoft Dynamics CRM!


Read More
%d bloggers like this: