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.
    formProperties
  2. Here’s the Account Form code I wrote. I created a JS file to call the Real-Time workflow.
    jsCode
  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”
    messageShown
  6. And once the execution is finished successfully, the notification is cleared.
    wfExecuted
    notificationCleared

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

Hope this helps!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.