Tuesday, September 30, 2008

Error in importing customizations when absolute path is long

Hi,
This is one strange error I have encountered, when you browse a customization file to import to dynamics CRM, it obviously gives an error when the total path is more than 100 characters long, (i.e.
C:/somefolder/inside1/inside2/inside3/my_customizations_backup/year/month/customizations.zip)

but, even when the path is close to 100 characters, Import may fail without any visible reasons, in that case, if you copy the file directly under drive, say C:/customizations.zip, it gets imported successfully.

Wednesday, September 10, 2008

Disable/Enable all fields on CRM entity form

While disabling fields from 1st method, some lookups, radio buttons and date fields may not get disabled, you have to disable them separately

// This loops through all elements of CRMForm, faster and consumes less memory

function disableFields(disableenable)
{
var CRMObjects = new Array(CF.,CF.,CF.,CF.);
for (i=0;i < CRMObjects.length;i++)
{
CRMObjects[i].Disabled=disableenable;
}

/*now disable all active form elements*/
for (i=0; i<>0)
{
if(crmForm.elements[i].Disabled==false)
{
crmForm.elements[i].Disabled=disableenable;

}
}
}



Another way................. this takes more memory as it takes all elements of the HTML of CRM form

//---------------------------------------------------------------------------------------------------

var iLen = crmForm.all.length;
for (i = 0; i < iLen; i++)
{ o = crmForm.all[i];
switch (o.tagName.toLowerCase())
{ case "input":
case "select":
case "textarea":
case "img":
case "iframe":
case “div”:
o.Disabled= true;
break

default:
break;
}

}

//---------------------------------------------------------------------------------------------------