Login to the required environment and go to flows and select Business process flows – Vaccination and observe whether BPF is active or not, if not then activate it as shown in the below figure.
After Step 1, as this BPF was written on the top of contact record, open any existing contact record as shown in the below figure.
After Step 2, click on F12 (developer Tools) from key board / open console window of selected browser, here I have used Chrome as shown in the below figure.
After Step 3, type the below code snippet to get the details of the current Process [BPF Details]
Snippet : Xrm.Page.data.process
And hit on enter key in the console window/tab
as shown in the below figure.
After Step 4, now assign the above snippet to a local variable with name vaccinationProcess with the below snippet
Snippet : var vaccinationProcess=Xrm.Page.data.process;
and then hit enter key after that verify the process name by using the below snippet
Snippet : vaccinationProcess.getInstanceName()
and observe that Vaccination name will be returned in the console window by API as shown in the below figure.
After Step 5, observe that before performing navigation current stage as Vaccination Status as shown in the below figure.
After Step 6, now go to the console window and execute the below snippet to move to the next Stage
Snippet : vaccinationProcess.moveNext()
and observe record current stage will be moved to Provide Discount from the previous stage and record automatically saved as shown in the below figure.
After Step 7, now go to the console window and execute the below snippet to move to the previous stage
Snippet : vaccinationProcess.movePrevious()
and observe record current stage will be moved to Vaccination Status from the previous stage and record automatically saved as shown in the below figure.
- If you take new record, then first save the record with required fields.
- Provide required fields on each stage before executing above steps otherwise navigation methods will not trigger.
- Observe every time when navigation methods were executed from console, record will be saved automatically, so that even you refresh the page it maintains Stage that was executed from console window.
- API Reference found here.
Conclusion: In this way, one can easily use Client API methods of navigation between stages in Business Process Flow before writing Java Script code quickly.