Filter Customer look up field to show only account.

 

You can use the script to filter the customer field to show account or contact records.










function setCustomerLookupToShowAccount(executionContext) {

var formContext = executionContext.getFormContext();

if (formContext.data.entity.getEntityName() === "contact") {

   if (formContext.getControl("parentcustomerid")) {

   var company = formContext.getControl("parentcustomerid");

   

   if (company.getEntityTypes().length > 1) {

company.setEntityTypes(["account"]);

   }

}

}

   

 }





// Register this on load evevnt.

Comments

Popular posts from this blog

Power Automate - Update Child record when parent record is updated by using power automate in MS Dynamics CRM

set the active stage in Dynamics 365 when the option set value is "yes"