In the post about Unified Service Desk for Microsoft Dynamics CRM I am going to give an example of how to use the ExecuteOnExpressionTrue action.
This example could be done by calling ExecuteOnExpressionTrue from your global manager. The ExecuteOneExpressionTrue action will exist on your global manager out of the box but can be added to any hosted control. So for this demonstration I’m going to create a UII Action on my “Contact” hosted control. Simply to illustrate the point.
So begin by starting to create an action linked to the Contact hosted control. Mine ends up looking like the one below;
When I tried to select ExecuteOnExpressionTrue, the action didn’t exist. So I selected new and simply added a new action. As I have shown below.
Let’s consider the data portion of this action in a little more detail, I have entered, “[[contact.donotphone]+]” == “true”. A fairly straight forward condition.
You will find the documentation on Microsoft’s site gives the following example of a data portion for this action. (Which is worth considering for a second as it hints as some additional capabilities.)
milliseconds=5000 function IsAccountLoaded() { return "[[account.Id]$+]" != ""; } IsAccountLoaded();
milliseconds=5000 would mean wait a maximum of 5 seconds for this action to be true. Useful if your data isn’t available instantly. (Although 5 seconds might be quite a long time for a use to wait!)
You can also see that JavaScript has been used to evaluate the expression. This syntax might be useful if you need to do a more complex comparison or wish to only return a true result if multiple items match your criteria.
But back to the action …… Having saved your action, you then add one or more sub actions that will be triggered if the results are true. In my example I am simply going to display a message warning the operator to not call this contact. The action I created to display the warning looked like this;
My action to display the message was then added to the sub actions on my ExecuteOnExpressionTrue action. Shown below;
All that remained was to trigger the ExecuteOnExpressionTrue action each time a contact was loaded, so I added my action to the BrowserDocumentComplete event on my Contact hosted control. As shown below.
Now when I open a contact who has their contact preference on “phone” set to do not allow, the operator will get a useful popup remaining them not to call the contact. This same message is also triggered when the “do not allow” setting is first applied. However, loading a contact who accepts phone calls gives no such warning message.
Hopefully this simply example has given you an insight into the ExecuteOnExpressionTrue action. J
Leave a comment