I have created two BPFs in the same entity and i want to switch BPF according to my selection in a choice field in the form.
I am also defining the event handler as on save option.
And my js code which I am using
function onLoadChangeBPFByType(executionContext) {
var formContext = executionContext.getFormContext();
var oppType = formContext.getAttribute(“casetypecode”).getText();
var activeProcessID = formContext.data.process.getActiveProcess().getId();
if (oppType == “Wildfire Case” && activeProcessID.toUpperCase() != “0ffbcde4-61c1-4355-aa89-aa1d7b2b8792”) formContext.data.process.setActiveProcess(“0ffbcde4-61c1-4355-aa89-aa1d7b2b8792”, callBackFunction);
};
function callBackFunction(result) {
if (result == “success”) {} else {}
}
And the error which I am getting is
ReferenceError: Web resource method does not exist: onLoadChangeBPFByType
at y._handleMethodNotExistError (org6de6fc86.crm8.dynamics.com/.../app.js
at y.execute (org6de6fc86.crm8.dynamics.com/.../app.js
at org6de6fc86.crm8.dynamics.com/.../app.js
at i (org6de6fc86.crm8.dynamics.com/.../app.js
at ee._executeIndividualEvent (org6de6fc86.crm8.dynamics.com/.../app.js
at ee._executeEventHandler (org6de6fc86.crm8.dynamics.com/.../app.js
at Object.execute (org6de6fc86.crm8.dynamics.com/.../app.js
at N._executeSyncAction (org6de6fc86.crm8.dynamics.com/.../app.js
at N._executeSync (org6de6fc86.crm8.dynamics.com/.../app.js
at N.executeAction (org6de6fc86.crm8.dynamics.com/.../app.js
Error Details:
Event Name: onsave
Function Name: onLoadChangeBPFByType
Web Resource Name: cr7af_SwitchBPF.js
Solution Name: Active
Publisher Name: DefaultPublisherorg6de6fc86