Filter Customer Lookup to only Accounts

If you want to restrict a lookup for the data type of customer there is a very simple way and it is not using prefiltering.

Simple JavaScript and a few lines of code will provide this functionality.

var formContext;
function onLoad(executionContext) {
    formContext = executionContext.getFormContext();
    filterCustomerLookup();
       
}
function filterCustomerLookup() {
    var customer = formContext.getControl('customerid');
    if (customer.getEntityTypes().length > 1) {
        customer.setEntityTypes(['account']);
    }
};


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *