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 :)
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
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,900 Super User 2024 Season 2
Martin Dráb 229,275 Most Valuable Professional
nmaenpaa 101,156