Hello there!
I'm currently developing a Model Driven Apps with a Business Process Flow. Now I got the requirement of advance the BPF to the next stage from the main view of the entity. I created a custom button in the command bar in order to achieve that.
The goal for this button is to select multiple records and advance their stage. Notice that I pass "PrimaryControl" parameter to get the executionContext of the selected records.
I post my JS code:
function BPFMoveNextStageSelected(executionContext) { //Initiated Form Context debugger; var formContext = executionContext; //Moving BPF to the next stage formContext.data.process.moveNext(function callBack(result) { if (result == "stageGate") { alert("Debe completar los campos obligatorios antes de avanzar de estado"); } else if (result == "end") { formContext.data.process.setStatus("finished", function callBackResult(stringRes) { if (stringRes == "invalid") alert("Debe completar los campos obligatorios antes de avanzar de estado"); }); } else if (result == "dirtyForm") { alert("Debe guardar el formulario para poder avanzar de estado"); } console.log(result); }); }
In this code when I access to some attribute inside fromContext variable I get this error in Chrome developer tools:
Any help is appreciated 🙂
Hi @aa33 thanks for answering!
I check the link above and I saw that I will have to hardcode stages GUID right?
I was trying to use moveNext JS method in order to follow automatically the BPF and check all the conditions to go through one branch or another. Is this possible to do with the solution you mentioned?
Regards.
formContext.data.process names are only available on the form of the record only. You will have to work with it using it as a data - https://learn.microsoft.com/en-us/power-automate/developer/business-process-flows-code
mmbr1606
22
Super User 2025 Season 1
stampcoin
17
ankit_singhal
11
Super User 2025 Season 1