Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Showing Dynamic Business Process Flow Stage Name

Posted on by 15

Hi guys

I have to customize a Business Process Flow in Dynamics 365 on the opportunity entity.

I have 4 boolean fields in a stage and they can be filled with 12 different combinations. Always two of them have to be filled with 'Yes'. 
For every combination, I need to combine these two field names into the next stage's stage name. You know what I mean?

The next stage has to be called like 'fieldname1, fieldname2' from the two fields with the value 'Yes'.

However, I tried to do that with two different ways.

Customization BPF: I wanted to add 12 conditions (for every possible combination) into the BPF. So I can show a different stage with a differnt name. Unfortunately, only 10 conditions are allowed...

HTML edit: I wanted to change the HTML element which shows the stage name with JavaScript. This script should have run onLoad and would have checked these combinations. Unfortunately, the JS function starts too early (HTML element is not ready for interaction). I also tried it with an async function, but the HTML element was still not ready. It worked in the console after the form was completely loaded, but it didnt't work with the onLoad trigger. I tried setTimeout too, doesn't work...

Does somebody have an idea how I could implement this? How can I show a dynamic stage name?

In the images below you cann see the 4 fields in the previous stage(left picture). The marked stage name has to be updated with changing to this stage (right picture). For this example, the stage name has to be updated to 'In Progress OPE, In Progress PM'.

Thanks for your help :)

pastedimage1611237387896v1.png7288.tempsnip.png

  • Dominik Mueller Profile Picture
    Dominik Mueller 15 on at
    RE: Showing Dynamic Business Process Flow Stage Name

    Thanks Wahaj,

    I tried the function isRendered(), but it didn't work...

    Creating a new field on the form/header was my emergency plan and I did now that. I think, some things are just not solvable with coding :)

    Best, Dominik

  • Verified answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Showing Dynamic Business Process Flow Stage Name

    Hi,

    Thank you for your query.

    Did you try using procObj.isRendered()?

    function onLoad(executionContext) {
    
        var formContext = executionContext.getFormContext();
        
        var activeProcess = formContext.data.process.getActiveProcess();
        
        var isRendered = activeProcess.isRendered();
        
        if (isRendered) {
        
            var stageObj= formContext.data.process.getSelectedStage();
        
            clonsole.log(stageObj.getName());
        
        } 
    
    
    }

    For changing the stage name, there is no supported method though. You can try using HTML.

    Furthermore, I would suggest you to add a field (or a calculated) field and place it on the form's header. And use it as a label to guide user regarding current stage.

    This can be achieved within supported behavior.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans