You would need to write the similar logic in the script based on your requirement as follows.
function filterCustomerAccounts() {
//Only show accounts with the type 'Preferred Customer'
var customerAccountFilter = "<filter type='and'><condition attribute='accountcategorycode' operator='eq'
value='1'/></filter>";
Xrm.Page.getControl("parentaccountid").addCustomFilter(customerAccountFilter, "account");
}
//set setParentAccountIdFilter in the Opportunity form Onload event handler
function setParentAccountIdFilter() {
Xrm.Page.getControl("parentaccountid").addPreSearch(filterCustomerAccounts);
}
Call the function “setParentAccountIdFilter” on OnLoad event of the entity form. So this way it would filter the child lookup based on the
Parent Lookup value selected.
Hope this helps!
Thanks,
Sam
Inogic |
Blog | news@inogic.com
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"