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

Create Folder On Share Point by using Power Automate In Dynamics CRM

Duplicate Detection Plugin code for Microsoft dynamics CRM