Using JavaScript to Go to Next Stage in Business Process Flows (Continued)

Leave a comment
BEFORE WE START, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

In a previous post, we look at how to go to the next stage in a Business Process Flow. Let’s continue this and look at more methods in the Client API to help us achieve this, including formContext.data.process.moveNext and formContext.data.process.movePrevious, which are useful if you need the BPF UI updated in real time.

If you prefer to learn by video, check out this video on my YouTube channel:

Let’s look at the BPF we have on the Account record.

If we jump into Debugger, we see there is a useful formContext.data.process, which gives us the BPF (I’ll run it below using the old Xrm.Page.ui.process):

Let’s assign a variable to this:

var process = Xrm.Page.data.process;

We can do a lot of things with this, such as attaching to the events when a user selects and changes stages in the flow.

The BPF at this point is unsaved, and therefore we can’t move to the next stage. Save the BPF:

This enables the Next Stage functionality:

Now let’s run process.moveNext(). This will automatically move the BPF to the next stage, without having to refresh the whole UI:

Running it again will continue to move it next:

And process.movePrevious() will move it backwards:

Note if you make a change that is unsaved, it will not move. You could run a save command in the JS before moving.

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *