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

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

Update Contact plugin Code MS CRM

Basics of C Sharp c# - 1