In this post I would like to look at a feature of Unified Service Desk for Microsoft Dynamics CRM that you might not have used before, ExecuteOnDataAvailable.
ExecuteOnDataAvailable – Delays the execution of the sub-actions until a specified set of replacement parameters becomes available.
The idea behind this action is to only fire the sub actions when one (or more) items of data are available. You can decide to wait indefinitely or to give a timeout, meaning if the data hasn’t been found after “n” milliseconds the action will timeout.
This might be useful if you want to trigger some actions when an entity loads that are only relevant if an item of data is available.
Below I will give an example of how this might work. With this example I am NOT trying to show you a useful bit of code! I am trying to show how the ExecuteOnDataAvailable action works. In my example I am simply going to display a message if a contact has a fax number and a mobile number. This could be achieved in a much simpler way! But this approach is still worth understanding as you may find it useful. Recently, for example, I used it to pause the load of a hosted control until another process had populated some required fields.
First of all, it is important to know that the UII action won’t get created by default when a hosted control is added. So you will need to add this UII action. Below you can see that I have added the action to contact.
Now the UII Action has been created you can create an action call that uses it.
In my action you can see that I have included three lines in the data portion. The first is “milliseconds=5000“, this means wait for up to 5 seconds. Then I have entered two fields I want to be present, meaning that fax and mobile must be present to continue.
Tip: The milliseconds statement is optional. If you want to pause indefinitely then that is possible by simply excluding this line.
Now, once the action is saved you can add one or more sub-actions that will be triggered if the data is available.
Below you can see that in my example I have added just one sub action. (You could add more)
And my sub action is very “silly”, it just displays a message.
I then added the action I have created to the BrowserDocumentComplete event on the contact. Meaning it will delay the open of the contact for up to 5 seconds. And if both fields become available popup the message I have defined.
So, now when I run USD. I the contact has a fax and mobile I get the message below almost straight away. But if they are missing one or the other of them the action will pause for 5 seconds, waiting to see if the data loads and then continues without giving the prompt.
I am sorry if this hasn’t been the best example in the world but I hope I have managed to explain how this action works. Trust me, in some circumstances this is a very useful trick to know. J