USD – RefreshRequested of Case

I love it when I can answer questions about Unified Service Desk for Microsoft Dynamics CRM.

I was asked a question yesterday about refreshing the case form. The problem was …. if you refresh an existing case from a toolbar the case form correctly reloads. But if you create a new case and then try the same refresh it goes “wrong”. As a refresh in this situation would display a new case form when you really want it to redisplay the newly created case.

This potentially looked like quite a difficult problem but actually the answer is really easy. Here is how I solved this problem …..

As I describe my answer to this question I am going to assume you already have a contact or account opening in a session. And from this you can create new cases or open existing ones.

  1. Create an action (Refresh case)
  2. Create an action (Navigate Case)
  3. Create an action (Display Message)
  4. Create toolbar button to fresh my case form.
  5. Add actions to the Case’s RefreshRequested event.

Step One – Create an action (Refresh Case)

First of all, I will need an action to refresh my case form. Although strangely this is never going to actually be used! (This will make sense in a second.)

Field Description
Name Case – Refresh
Hosted Control Incident
Action Refresh

Step Two – Create and action (Navigate Case)

Next we will need the action that will actually be used to fresh the case. When the refresh is clicked I am going to need to re-display the currently displayed case. When I open an existing case this action will mirror the refresh functionality. But when working with a new case it will refresh the newly opened case correctly.

Field Description
Name Case – Navigate
Hosted Control Incident
Action Navigate
Data url=main.aspx?etn=incident&pagetype=entityrecord&id=%7B[[Incident.Id]]%7D

To explain, this url will display the case form. Notice that I have added the Incident.Id of the current case.

Condition “[[Incident.Id]]”!=””

This condition will mean the action will only be fired if we have an incident loaded.

Step Three – Create an action (Display Message)

Next I needed to decide what to do if I didn’t have a incident.Id. As my navigate action wouldn’t work. I decided the best approach might be a friendly message to the user.

Tip: An alternative approach might be to not present the toolbar refresh button until an Incident.Id is available!

Field Description
Name CRM Global Manager – Display Message (Save Case)
Hosted Control CRM global Manager
Action DisplayMessage
Data text=Please save case first!


Condition “[[Incident.Id]]”==””

This condition will mean the action will only be fired if I don’t have an incident. Which will happen if the user has started to create a new case but hasn’t yet saved it.

Step Four – Create toolbar button to refresh my case form.

You might have this already!

I am assuming you have a toolbar on the case form already.

Field Description
Name Case refresh
Image New_Refresh_16

I had an image of the refresh icon loaded as a web resource, so I simply used that. If you don’t have an image an alternative approach would be to set button text to “Refresh”.

Tooltip Case Refresh
Show Tab Incident
Order 4

As my refresh button was my 4th button. Other numbers are available!!!

Actions I added the action I created in step one here. (Case – Refresh)

Step Five – Add actions to RefreshRequested Event

As you have seen I am going to fire the refresh action as normal but that I will alter the RefreshRequested event for my incident form to actually use the other two actions I created. Below you can see I have added the two actions to my RefreshRequested action.


Finally, I tested my changes to prove they worked. If I click my refresh icon on a newly created but not saved case I display the message below.

But if I click refresh after saving the case that case will now be correctly refreshed. When prior to my changes a new case form would have been displayed.

I did find a problem with this! I have found that the RefreshRequested event does not behave as expected! Firing a refresh action does trigger the RefreshRequested event. But if the user presses F5 the event isn’t triggered. I suspect this might be a product issue! As I this the event should always be triggered. I am using USD, hopefully in future versions this issue is resolved.

I hope this answers the question I was asked. J

5 thoughts on “USD – RefreshRequested of Case

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

  2. Hi Neil,

    To achieve the same, we tried the above solution which you have shared.
    but this solution is not working in our case. We are using USD 1.2. Here in debugger this URL :
    url=main.aspx?etn=incident&pagetype=entityrecord&id=%7B[[Incident.Id]]%7D is showing error because it’s unable to replace the [[Incident.Id]]

    After looking in to USD debugger , we came to know that we have to construct the following URL:

    Whenever we open any case record , we get the same URL except [[incident.Id]] and histKey . Here [[incident.Id]] is evaluated flawlessly, but we don’t know to replace histkey..
    Please help to get record specific histkey. here we are not able to get replacement parameter to get dynamic histkey


    • Thanks for your message. I suspect histkey isn’t your problem, as you will have seen I haven’t included that in the url.

      In the debugger you are seeing url=main.aspx?etn=incident&pagetype=entityrecord&id=%7B[[Incident.Id]]%7D …. I think this might suggest the replacement parameter [[Incident.Id]] hasn’t been substituted. I think you should be seeing the Incidents GUID instead!

      Is the hosted control for your case called “Incident”? If not that could be the problem. Say your hosted control is called “Case”, then you’d use [[Case.Id]] instead, you could also try [[incident.Id]] (Note: If you change the replacement parameter used don’t forget to also change it in the condition.) Have a look at the replacement parameters in the debugger and see if you can see the correct replacement parameter for your incident.Id?

      You comment you are using version 1.2 of USD. The current version is 2.1.1 so yours is quite old. But I am not aware of any issues with the navigate action in older versions. Although I wouldn’t be so confident about the RefreshRequested event. Upgrading, if you still have issues, might be worth trying.


      • Thanks Neil,
        This solution worked. After replacing the [[incident.Id]] with my hosted control’s name, and after changing condition in CRM -Navigate and CRM-Global Manager, I got the desired result.
        Many Thanks 🙂


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 )

Facebook photo

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

Connecting to %s