Please use this function in onload of the form.
FilterLookupUponParent = function(source, target) { if (IsNull(source) || IsNull(target)) { return; } var name = IsNull(source.DataValue) ? '' : source.DataValue[0].name; target.additionalparams = 'search=' + name; }
Use this code to call the function, passing the form field names.
FilterLookupUponParent(crmForm.all.new_accountid, crmForm.all.new_primarycontactid);
Here it is illustrated that, RAW Ltd has two contacts.
Once we use above code, when clicking the lookup field will pop up the lookup window only with those contacts that are relevant to the selected RAW Ltd. This is actually a filter. Once you release the filter, you get all the contacts.
Actually, it is also wise to call the same method is onChange event of the customer, because filter should get changed accordingly.
Hope this will help you.
No comments:
Post a Comment