USD – RefreshRequested

With Unified Service Desk (USD) for Microsoft Dynamics CRM we have an event called RefreshRequested, but what does this event do and when might we use it? I wanted to find out so I investigated ….

The reference guide on the Microsoft site stated the following about RefershRequested.

Source :

This suggested that the RefreshRequested event would be triggered when firing a Refresh action OR the user pressing F5. However, this didn’t quite match the behaviour I observed.

What actually happened was that firing a refresh action triggered the RefreshRequested event but pressing F5 didn’t. This might be a product issue with the particular USD version I was using. (My Unified Service Desk version was

As a test I added an action to the RefreshRequested event of my Contact tab. As this was a test I simply displayed a message. You can see my event below. The action was a simply DisplayMessage action.

When my action was triggered I would then see the event had been triggered because I would get an alert like this.

With F5 – I loaded a CRM page in a tab. In my test I used contact but all entities behaved the same. Clicking F5 with the newly loaded tab displayed initially did nothing. But when I clicked into a field on my contact and then pressed F5 the form refreshed. But NO RefreshRequested action was triggered.

With a Refresh action – If a refresh action was used, I saw my popup and the form was not refreshed.

So the first concern with the event was therefore be to understand when it should be triggered. But when the event had been triggered what happened next?

The important thing to note was that having triggered an action in the RefreshRequested event a refresh didn’t happen. This is very useful and the behaviour I hoped to see!

If I was going to use this event in a production solution I’d watch to capture the refresh, do some actions and then finally refresh the tab. (or not!)  So next I turned my attention to the final piece of refreshing the contents when required.

My first attempt failed badly! I simply added a refresh action after my display message. If you do this the refresh action will trigger another RefreshRequested event and you’ll enter an endless loop. So not what was needed!!!

I found an approach that would let me refresh the CRM form without creating an endless loop that was to fire a fresh from a RunXrmCommand action.; My action looked like this;

Meaning my RefreshRequested event now looked like this;

The result now was a popup saying “RefreshRequested” followed by the form actually refreshing. Perfect. J

In a previous post I explained the SessionCloseRequested event. In that I showed how you might want to validate the contents of the session and then allow the session to close or not. I mention this now as that design pattern is exactly how you’d want to use the RefreshRequested event. For example: You might want to prevent a refresh if any unsaved data existed. Or maybe you would only allow a refresh if all mandatory fields have been completed etc.

Alternatively, you could do something other than refresh the entire page. For example: You may decide to only refresh a particular subgrid rather than the complete form.

Tip: To refresh just a subgrid use a RunXrmCommand with a code like this Xrm.Page.ui.controls.get(<<sub grid name>>).subgrid.refresh();

In summary the RefreshRequested event, when triggered, behaves as exactly as required. Allowing you to substitute the page refresh with alternative behaviour. And when required, with the help of a RunXrmCommand you can still refresh the page. 

But in my test the way the event was not triggered when the user pressed F5 was a problem. It meant I couldn’t actually use it in the way I required. But hopefully that issue is specific to the version of USD I was using. ( If later versions of USD resolve this issue I will update this post accordingly.

I hope this post has been useful and that I have described the positives and negatives of this event. And also given you a few ideas on how it might be used. J

4 thoughts on “USD – RefreshRequested

  1. Hi Sir,

    I am facing one of the challenge in the USD related to refresh

    1.) I have fetch a My Active Cases view in USD, then I click on one of the case record, & it opens that record in the form of session, now if I click on Refresh button on toolbar, then its refreshing my case form as required.

    2.) Now I clicked on “NEW” button on Case form ribbon to open a new case into new tab in the form of session & I filled the required details & save the case form, now if I click the Refresh Button, instead of refreshing the case form which I just created, its opened new case form for me into the same tab (that means the case i just created is overwrite by New Case form, when I click on Refresh Button).

    when i tried to explore the reason in DEBUGGER, its showing me a after “refresh action call” “case session” hosted control is getting trigger & URL its hitting is opening for a new case form & not to refresh action.

    Don’t know how to tackle this issue, its critical stage of our project implementation.

    I even used “;” but malfunctioning behavior is not yet changed.

    can Window navigation order be a problem area here ?

    USD Version : 1.0
    CRM 2015 On-prem org. (But i don’t thinks its a version related issue, because i had updated the version of USD on the testing environment but result didn’t change at all)

    Please try to help !!!!!!!!!


  2. Pingback: USD – The Book | Microsoft Dynamics CRM and Unified Service Desk

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s