Use setFormNotification (Client side JS) in D365 v9 while Real-Time workflow is executing - CloudFronts

Use setFormNotification (Client side JS) in D365 v9 while Real-Time workflow is executing

Often, when a real-time workflow is being executed in the background, users don’t know how long it will take for the processing to finish. setFormNotifications in D365 v9 come handy!

Scenario

Here’s how I put my scenario –

  1. I call the Real-Time workflow using JS, example, on change of a certain field or the JS being called from the Ribbon button.
  2. The JS will trigger the Real-Time workflow I have.

Now, while the Real-time workflow is running, the user doesn’t know it has been called and should the user retry the same action? Here’s when the form notification is vital.

While the processing is happening, the message will remain as a notification on the form. Once the processing is complete, the notification will be cleared.

JS Implementation:

For the JS code implementation, the function to call the workflow needs ProcessJS which is available on https://github.com/PaulNieuwelaar/

  1. So on the Form, I’ll add my file after ProcessJS file.
  2. Here’s the Account Form code I wrote. I created a JS file to call the Real-Time workflow.
  3. In the above code, the Xrm.Page.ui.setFormNotification(Message, Type of notification, Unique Identifier); This will set the notification.
  4. Page.ui.clearFormNotification(UniqueIdentifier); will clear the notification from screen.
  5. Using this, When the Process enters in Processing mode, the message is shown on screen as “Please wait while processing”.
  6. And once the execution is finished successfully, the notification is cleared.

Similarly, you can even use this approach for WebAPI calls and have clearFormNotification set in the Success/Failure callbacks.

Hope this helps!


Share Story :

Secured By miniOrange