Dynamics CRM 4.0 - Filtered Lookups From Picklist Value

,
Howdy, 


The below script is for doing filtered lookups based on a picklist value - nice piece of script!


document.FilterLookup = function(source, target)
{
    if (IsNull(source) || IsNull(target)) { return; }
    var name = IsNull(source.DataValue) ? '' : source.SelectedText;
name=encodeURIComponent(name);
    target.additionalparams = 'search=' + name;
}
document.FilterLookup(crmForm.all.yourpicklistfieldname, crmForm.all.yourlookupfieldname);



Paste the following into the OnChange event of the Picklist:

document.FilterLookup(crmForm.all.yourpicklistfieldname, crmForm.all.yourlookupfieldname);