USD – Event Timers

In Unified Service Desk for Microsoft Dynamics CRM we have a concept of an event timer. In this post I will explain how this works with an “annoying” example.

Two actions are involved in this example, StartEventTimer and StopEventTimer.

Firstly, let’s consider when you might want to use these actions, the concept here is that an event is going to be repeatedly triggered every “n” milliseconds. This could be used to do all sorts of things, one example being to refresh a tab. I have a tab which shows announcements, I could use this approach to refresh that tab to show the latest announcements every few seconds.

By way of an example I will actually create a very annoying example, I am going to popup an “Hello World” message every 8 seconds.

First of all, I needed to create an event to trigger. I called mine “TimerEvent”. I would then attach an action to that event. My event is shown below. To create this I simply loaded my global manager hosted controls went to events and added a new one. I just needed to give it a name of “TimerEvent”.

You can see above that I added an action to my newly created event. For the purpose of this example this was a display message action. (You could do something much more interesting!) My hosted control was CRM Global Manager and my action was DisplayMessage. Notice that I set the text of my message to “Hello World Again!” and my caption to [[count]].

Next I needed an action to start my event timer, in my example I was going to start this from the debugger. If however we think of my suggestion to use this to refresh a tab then I would have started the timer on the BrowserDocumentComplete event of my announcement tab.

My event timer looked like this ….

Field Description
Name Could be anything, I called mine “CRM Global Manager – StartEventTimer”
Hosted Control CRM Global Manager
Action StartEventTimer
Data eventname=<<event name>>

milliseconds=<<number of milliseconds between event calls>>

name=<<The name of this timer>>

Naming the event is useful as you could create multiple timers.

Naming the timer is useful, as we can then reference this in a stop action.

Next I loaded my debugger and started my annoying example. Please think of a better use than this!!! J Below you can see that my action was executed and my message started to popup every 8 seconds. Lovely!

Also notice the title of my popup box. This is a counter that increments each time the event is run. The replacement parameter for this is [[count]]. I imagine this might be useful if you want to fire an event “n” times. Also notice that the counter starts at zero.

Now we have another IMPORTANT action to look at StopEventTimer, this simply included the name of my timer in the data portion. One point here is that it seemed to stop another timed event starting. Meaning, if after 4 seconds I fired a StopEventTimer and my event is happening every 8 seconds. I get one more event triggered before it stops.

This example has been pretty annoying and not very useful! But hopefully you get the idea that we can start and stop timers to repeatedly trigger events in USD. Something that will be very useful if you want to repeat any action.

Enjoy. J

One thought on “USD – Event Timers

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