
Hi,
I have a BPF in orders entity. Once we click on the last stage of the BPF, the status of the record will change to submitted. I want to refresh the form as soon as this happens. Since I am not changing the status manually, I can't trigger a JS on change of Status field. Is there any way to achieve my requirement?
Thanks.
Hy Partner,
Hope this post finds you well. You can register the javascript on Onload of the form with event handler defined in the function. Event handler name is addOnStageChange() : https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data-process/eventhandlers/addonstagechange
Once it is register,it will fire the function register in the above event.
In this function check if active stage is the last stage. Compare it with name of the stage and if it satisfies , you can refresh the form.You can also check the status of the record as well along with this condition and fire the refresh.
For getting active stage name : https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data-process/activestage/getactivestage
For refreshing the form : https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data/refresh
Hope this helps.
Best regards,
Ankit
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.