Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Sales forum / Business process flow ...
Sales forum
Suggested answer

Business process flow stages hide/show based on the multiselect option from the form

Posted on by 7
Hi Experts,
 
Can any one help me out this, while I am creating a business process flow in opportunity form, I want to show/ hide the multiple stages based on the multi selected option from the opportunity form use case below.
 
Type 1- Stage 1, Stage 2
Type 2- Stage 3, Stage 4
Type 3- Stage 5, Stage 6
Type 4- Stage 7, Stage 8
 
When new opportunity is created, no stage to be displayed.
On save, if type 1, type 2 is selected then Stage 1, Stage 2, Stage 3 and Stage 4 will be displayed. Steps under stages will remain same. No need to show/hide
 
Thanks in advance
  • Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Business process flow stages hide/show based on the multiselect option from the form
    Hi,
     
    Has the issue been solved?
    Have there been any updates? Please feel free to ask me if you have any questions!
    If it has been resolved, can you mark the response as an answer?
     
  • Suggested answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Business process flow stages hide/show based on the multiselect option from the form
    Hi,
     
    You can design BPF and JavaScript to fulfill the requirements.
     
    Since multi-select choices cannot be used for BPF, only single-select options can be used.
    stage1 cannot be hidden.
    Displays all stages when the /type/ field is empty.
    When the value of the /type/ field is type1, it displays stage2, stage3, and stage4.
    When the value of the /type/ field is type2, stage7, stage8 are displayed.
     
    Add Form OnLoad event.
    I added a custom Yes/No field /Whether to shou BPF/ to control the entire BPF display.
    When a new record is created, the value of this field defaults to No. Therefore, the BPF is not displayed by default.
    function onload(executionContext) {
        var formContext = executionContext.getFormContext();
       
        //Gets the value of the Whether to show BPF field.
        var showBPF = formContext.getAttribute("crc2c_whethertoshowbpf").getValue();
     
        //When the value of the Whether to show BPF field is No, the BPF is not displayed.
        if(showBPF === false){
            formContext.ui.process.setVisible(false);
        }
    }
     
    Add an On Change event to the /type/ field to display the BPF when this field changes.
    function onchange(executionContext) {
        var formContext = executionContext.getFormContext();
                formContext.ui.process.setVisible(true);
    }
     
    The final result is shown 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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,353 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans