web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Load Business Process Flow(BPF) in Form

(1) ShareShare
ReportReport
Posted on by 5,514
Hi All,
 
Hope All is Well.
 
I have requirement Where I have 2 BPFs in Opportunity Entity 
 
Need to Achieve
1. BPF-1 on Load
2. BPF-2 on load
 
Where in Opportunity Where I have 2 forms.
 
In both the forms I have field name=/OpportunityType/(optionset)
 
If I select OpportunityType= Sales-A  then Form 1 should load and Show BPF-1
If I select OpportuntiyType= Sales-B  then Form 2 should load and show BPF-2
 
 
 
Currently I am stuck to load BPFs. can anyone help to fix this ASAP.
 
Below is the code written on Form -OnLoad and On change but this seems to be not working.

function setBPF(executionContext) {

    var formContext = executionContext.getFormContext();

    var currentBpfID = formContext.data.process.getActiveProcess().getId();

    var OpportunityType = formContext.getAttribute(/c360_abc/).getValue();

if (OpportunityType == /55XXXXX/ && currentBpfID != /2AXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX/) {

        formContext.data.process.setActiveProcess(/2AXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX/);

        alert(/Sales BPF 2AXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX/);

    } else if (dealType == /556XXXXX/ && currentBpfID != /BFXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX/) {

        formContext.data.process.setActiveProcess(/BFXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX/);

        alert(/Origination BPF BFXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX/);

    }

}

 

can Anyone help on immediate basis please as this is P-1

 

 

Thanks

Sandeep

I have the same question (0)
  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    Hi Sandeep,
    1.Maybe you need change dealType to OpportunityType here:
    2.You should add one condition to get and determine current form.
    Based on your description, you should switch form firstly, then load BPF.
    Please refer to my example code:
    function switchFormAndBPF(executionContext) {
        // For Example -
        // Oppirtunity Type: Sales-A    100000000 | Form 1 : bde0ad61-06d4-4db9-a0c4-64aac2ba413b  | BPF-1 2AXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX
        // Oppirtunity Type: Sales-B    100000001 | Form 2 : 845f6eb8-1956-4c42-90d6-042528e69ade  | BPF-1 BFXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX
    
        var formContext = executionContext.getFormContext();
    
        var listOfAvailableForms = formContext.ui.formSelector.items.get();
        var currentForm = formContext.ui.formSelector.getCurrentItem().getId();
        var currentBpfID = formContext.data.process.getActiveProcess().getId();
        if (formContext.getAttribute("cf_opportunitytype")) //Determining if an opportunity type field has a value
        {
            var opportunityType = formContext.getAttribute("cf_opportunitytype").getValue();
            if (opportunityType == "100000000" && currentForm != "bde0ad61-06d4-4db9-a0c4-64aac2ba413b") {
                listOfAvailableForms.forEach(element => {
                    if (element.getId() == "bde0ad61-06d4-4db9-a0c4-64aac2ba413b")
                        element.navigate();
                });// load form 1
                //load BPF-1
                if (currentBpfID.toUpperCase() != "2AXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX") {
                    formContext.data.process.setActiveProcess("2AXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX");
                    alert("Sales BPF 2AXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX");
                }
            }
            else if (opportunityType == "100000001" && currentForm != "845f6eb8-1956-4c42-90d6-042528e69ade") {
                listOfAvailableForms.forEach(element => {
                    if (element.getId() == "845f6eb8-1956-4c42-90d6-042528e69ade")
                        element.navigate();
                });// load form 2
                //Load BPF-2
                if (currentBpfID.toUpperCase() != "BFXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX") {
                    formContext.data.process.setActiveProcess("BFXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX");
                    alert("Origination BPF BFXXX-XXXXX-XXXX-XXX-XXXXXXXXXXXX");
                }
            }
    
        }
    }
    Note:
    You can get form id from the url--A837E4A7-01B8-4F82-A475-BE9ABD67E667

    I hope you can mark my answer verified if it answer your question! If you have any questions, please feel free to contact me.
    Regards,
    Leah

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 81 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans