USD – Session Timer

Unified Service Desk (USD) for Microsoft Dynamics CRM contains the ability to show a timer on sessions, sometimes it is useful for operators to see how long they have been talking to the customer. Also, this timer can change colour depending on the length of the call. Acting as a visual prompt to the operator that maybe they haven’t handled this query fast enough!

The timer control will be available by default in the sample packages provided by Microsoft but if you aren’t using one of those you’ll need to configure it from scratch. Here are instructions on how to create and configure the timer control.

Also there are a couple of actions that you can add to take a copy of the timer values. This might be useful if you want to then update the phone call entity with this information etc.

Step one – Create host control for the timer

Step two – Configure the timer colour changes

On the timer hosted control you can optionally add extensions to drive what colour the timer is displayed in and trigger changing the colour after “n” seconds. Some sample code is below, hopefully you get play around with this to create the effect you require.

<threshold backgroundcolor="#E4E4E4" />
<threshold foregroundcolor="#EEEE00" seconds="70"/>
<threshold foregroundcolor="#FF0000" seconds="90"/>

Step three – Add uii actions to return timer information to the context

There are two useful uii accounts on your timer hosted control, I don’t believe these exist by default so you may need to create them.

  • GetSessionSeconds, returns the total time, in seconds, that the session lasted.
  • GetSessionUsageInSeconds, returns the total time, in seconds, when the agent was active in the current session.

Below you can see what my uii actions looked like. Essentially I just created these setting the name and hosted application fields. All other fields were left with the default values.

Step four – Create actions to copy timer information to the context

Now you have the uii actions you can create action calls to trigger at appropriate points. I’m going to demonstrate the actions being run from the debugger, hopefully you will be able to adapt this concept to create action calls and execute as you require. Below you can see that I ran GetSessionUsageInSeconds and GetSessionSeconds in the debugger. (With a session open!)

Now, when you refresh the data parameters if you look under $Return you will see two new parameters.

Assuming you wish to use these replacement parameters in other actions then simply reference them as follows;



You may (for example) find it useful to update a field on the phone call based on this information.

Hopefully this post has been useful and has given you some ideas on how to use the timer hosted control in USD. J

10 thoughts on “USD – Session Timer

  1. Hi,

    Its great that you go extra mile to explain the things, as I know how to configure session timer but I learned more things from your article.

    one unrelated question : I am facing a challenge, like I have three type of session in USD configure namely contact, account & case. I want my agent script to be loaded in left panel only in case of contact & account session but it also get loaded in case session also. I don’t know why.

    Note : I had checked whether the BrowserDocumentComplete Event contains the case session hosted control but it didn’t …………..Any comment ? You the saviour🙂


    • Assuming your agent script GotoTask action is on the BrowserDocumentComplete event of the correct entities then you should be ok. As the agent script would be loaded when specific tabs are opened.

      If you are getting problems with this looking at the events in the debugger should help you find which BrowserDocumentComplete event is firing your agent script action.

      An alternative approach might be to try moving the GotoTask action to another point. Maybe as an action from your navigation rule that starts the sessions.


  2. One more question where does the data related to time taken on each session store in CRM, as it can be use for reporting purpose, I hope you find this question relevant as it can help in estimating the agent productivity.


    • Thanks for your comment, simple answer is the data doesn’t store in CRM. At least not by default.

      But once you have the information in replacement parameters you could update fields on a CRM entity. (Maybe by using a RunXrmCommand.) Or maybe use the CreateEntity action to create a log of session times. The approach would obviously differ depending on the requirement.

      It would be a bit of effort but not that hard once you have the information available.

      Hope this makes sense.


  3. As you said it will be a time consuming task & when a call centre agent receive so many calls on daily basis then Update the session time manually (Using Create entity) will be very difficult task, which no agent would like to do.


    • Not sure I explained my comment well enough! I didnt mean the agent would do it. But that you’d have a usd action the on close of a session would update phone call etc. Or maybe create a new entity. You could (for example) have a custom entity and insert a row each time the agent closed a session. Maybe including agent name, session time and possibly links to phone (etc). (you would most likely add this action to the session close on global manager.)


  4. In the above agent script issue in debugger, I found that there is a event called task updated which is triggering through my agent script hosted control but couldn’t find solution of my problem as I don’t know how to stop it for case session only


    • From memory, the event you mention will be on your agent script hosted control. I think this only returns the name of the agent script not the name of the answer selected in the script.

      If you want to fire an action that is specific to clicking a given agent script answer you do that by adding actions to the answer itself.

      Hope this makes sense.



  5. 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