in Sales Hub app, Lead entity with a main form: SalesHub-Lead. There are two Lead BPFs in this app: SalesHub- Lead to Opportunity Process (Custom) and Lead to Opportunity Process (System).
Requirement: Opening SalesHub-Lead form always display the SalesHub-Lead to Opportunity Process. My script as below:
function onLoadSetDefaultBPF(executionContext) {
debugger;
var formContext = executionContext.getFormContext();
var activeProcessName = formContext.data.process.getActiveProcess().getName();
if (activeProcessName == null || activeProcessName !== 'SalesHub - Lead to Opportunity Process') {
var parameters = {};
parameters['process'] = 'SalesHub - Lead to Opportunity Process';
Xrm.Navigation.openForm(/lead/, null, parameters);
}
}
//===================================================
Implemented webresource in SaleHub-Lead form, it's not working. The error message:
One of the scripts for this record has caused an error. For more details, download the log file.
Cannot read properties of null (reading 'getName')
Session Id: 3325fc28-9410-45cd-80e4-
Correlation Id: 73e0c609-e108-4194-aaee-
Event Name: onload
Function Name: onLoadSetDefaultBPF
Web Resource Name: SaleHub_lead_setdefaultBPFbasedonapp.js
Solution Name: Active
Could you please help to check what problem I have made?
Thanks!