Skip to main content
Dynamics 365 general forum
Answered

Showing Dynamic Business Process Flow Stage Name

editSubscribe (0) ShareShare
ReportReport
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

Attachments
  • 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,317 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.

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,080 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,601 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans