Thursday, May 27, 2010

Collapse Sections in CRM 4.0

Here's some code that will collapse sections on CRM 4.0.

/*Function figures out if id of element is a GUID.  Useful for collapsing sections*/
crmForm.DC_IsGUID = function(expression)
if (expression != null)
var pattern = /^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$/;
return false;

crmForm.DC_ToggleSection = function(element, open) {
while(!crmForm.DC_IsGUID( {
element = element.parentNode;
if(open) { = "block";
{ = "none";

Happy coding...

Tuesday, May 4, 2010

Retrieving the org name from the URL string

I was just getting ready to write some JavaScript code to parse the org name out of the URL string when I decided to see if someone else had already written the code. I was digging around on Google when I found this function: prependOrgName(). The function is one of the global functions inside CRM. See this link.

Nice work Microsoft!