-
Opportunity Sales Process Isn't Auto-Connected to an OpportunityHi Dengliang Li,I appreciate your help.I've implemented the code, but it still not working.
-
Opportunity Sales Process Isn't Auto-Connected to an OpportunityHi,You can implement this with the following JavaScript code.var Sdk = window.Sdk || {};(function () {//A global variable to store information about enabled business processes after they are retrieved asynchronouslythis.enabledProcesses = [];// Code to run in the OnLoad eventthis.formOnLoad = function (executionContext) {// Retrieve the formContextvar formContext = executionContext.getFormContext();//Determines if there is currently an active Bussines process flow.if(formContext.data.process.getActiveProcess()){return;}// Retrieve Enabled processesformContext.data.process.getEnabledProcesses(function (processes) {//Move processes to the global Sdk.enabledProcesses array;for (var processId in processes) {Sdk.enabledProcesses.push({ id: processId, name: processes[processId] })}console.log("Enabled business processes flows retrieved and added to Sdk.enabledProcesses array.");//Write the values of the Sdk.enabledProcesses array to the consoleif (Sdk.enabledProcesses.length < 0) {console.log("There are no enabled business process flows for this table.");}else {console.log("These are the enabled business process flows for this table:");//Determines if the current entity has only one enabled Bussines process flow.if(Sdk.enabledProcesses.length === 1){//Sets the BPF in the current entity as the active BPF.var enabledProcessId = Sdk.enabledProcesses[0].id;formContext.data.process.setActiveProcess(enabledProcessId)}}});};}).call(Sdk);The APIs used are referenced below.If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
If you have further questions, please feel free to contact me .
Best Regards,
Dengliang Li
Helpful resources
Quick Links
Subscribe to
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
Leaderboard
a33ik 84,305 Super User
Sukrut Parab 71,633
YUN ZHU 60,219 Super User