Wednesday, August 19, 2009

Dynamic Picklist in CRM 4.0

var PAccountType = crmForm.all.new_picklist;
PAccountType.originalPicklistOptions = PAccountType.Options;
var PStartIndex =2;
var PEndIndex =3;
if (PStartIndex > -1 && PEndIndex > -1)
{
// Create a new array, which will hold the new picklist options
var PTempArray = new Array();

// Initialize the index for the temp array
var PIndex = 0;

// Now loop through the original Sub-Industry options, pull out the
// requested options a copy them into the temporary array.
for (var i = PStartIndex; i <= PEndIndex; i++)
{

PTempArray[PIndex] = PAccountType.originalPicklistOptions[i];
PIndex++;
}

PAccountType.Options = PTempArray;

No comments: