I have seen various threads on getting a lookup to filter in the BPF. Using the example from here:
( ) How to Filter Lookups in a Dynamics 365 Business Process Flow - Microsoft Dynamics CRM Community
I actually want to do exactly the same thing but am confused. This is to filter the contact lookup on the BPF based on the account selected.
These fields are primarycontactid and customerid.
This is what I am trying to use, does this look correct?
function filterBpfLookup = function(formContext) { if (formContext.getControl("header_process_primarycontactid") !=null) { formContext.getControl("header_process_primarycontactid").addPreSearch(filterDefinition); } function filterDefinition = function(formContext) { var accountId = null; var accountLookup; var filterBpf; if (formContext.getControl("header_process_primarycontactid") != null && formContext.getControl("header_process_primarycontactid").getAttribute().getValue() != null) { accountLookup = formContext.getControl("header_process_customerid").getAttribute().getValue(); accountId = accountLookup[0].id; if (accountID != null || accountID != undefined) { filterBpf = "" "" ""; formContext.getControl("header_process_primarycontactid").addCustomFilter(filterBpf); }}}}
Please note that I cannot write JScript to save my life.
Also if correct, do I add this to the onLoad of the form or somewhere else?