USD – Agent Scripting Extra Actions!

Whilst researching actions / events in Unified Service Desk (USD) for Microsoft Dynamics CRM I stumbled across a couple connected with agent scripts I hadn’t seen before.

On the Microsoft site you will find a description of the agent scripting hosted control and its actions / events. But two actions aren’t mentioned! (Hopefully they will be added soon.)

Until they are added, the details are as follows;

Action – ClearHistory

Clears the agent script history by clearing the values in the drop-down list on the Agent Scripting hosted control. In a single call an agent can load multiple scripts, below I show a screen shot of the history showing three scripts which have bee loaded.

It might be that you want to clear this list. Maybe this could happen if the customer has multiple requests in one call. Or maybe having completed an initial verification script you want to clear that from the history.

Below you can see I have given an example by running the ClearHistory action in the debugger. Notice that under the CALL SCRIPT heading the history drop down is now blank.

The ClearHistory action clears the script history it doesn’t stop the current running script.

In a real example I might follow the ClearHistory action with a GotoTask action to load a new script. (To replace those I’ve cleared.)

Action – RegisterVisitedAnswerList

Registers an event to be invoked when a specific task is reached.

name The name of the registration.
step The agent script task name that you want to register an event for.
The remaining parameters should consist of

<answername>=<bool value> pairs.

If <answername>=true, it will fire the event if the answer has been visited. If <answername>=false, it will fire only if the answer hasn’t been visited.   If an answername isn’t included here but is included in the list of answers on the task, the event is fired regardless of whether it has been visited or not.

When the conditions are met, the RegisteredVisitedMatch event will be fired, with the following parameters:

task=<task name>
taskid=<task guid>
name=<registration name from above>

Below you can see an example of how I have run this action in the debugger. Before I ran this action I also created an event on my agent scripting hosted control called “RegisteredVistsedMatch”.

Once this action has been run, the RegisteredVisitedMatch event will trigger once the created case AND Send Email answers have been selected. As I have shown below.

This action is designed for advanced situations when you wish to trigger an event when certain combinations of answers are true (or false). Maybe, for example, you want the event to be triggered if an operator has created a case and an opportunity from a script. Or if an agent has created a case but hasn’t sent an email etc.

Hopefully you will find ClearHistory and RegisterVisitedAnswerList useful. J

13 thoughts on “USD – Agent Scripting Extra Actions!

  1. Hello Neil,

    I congratulate you on your web, I am serving me much help within dond project we are implementing USD.

    I wanted to ask you a question about the action “clear history” script agen, I’ve tried and I clean perfectly the dropdown agent script, but questions me still leaves marked with the chek, is there any way by any action clean the questions that are within agent script ??

    Greetings and thanks for everything.


    • I found it cleared the history and the questions. But didn’t clear the current script that was active. I think if / when I use this action I would clear the script with it and immediately follow it with another action. A GotoTask to load the script I want to now have active.

      Thanks for your comments on my blog. I do my best! I use my blog as a way to learn new things so it benefits me and if a few other people benefit then that is a bonus. 🙂


      • Hi Neil

        How are you?

        thank you very much for answering this issue, but I think I have a problem with “ClearHistory action” the action does not remove the agent checks of the “answer script”.

        I think the problem has to be in some settings of USD, yesterday I implemented your method “USD – Agent Scripts – Customer Verification” and makes all right except update the values of the parameters on agent script answer.

        Do you have any idea??

        Neil A greeting and thank you very much for the great blog you are creating 🙂


      • Unfortunately the results you have had were my experience it does clear the history. Meaning if you have navigated to multiple agent scripts it would clear the list you have viewed. But it didn’t clear the details currently displayed. I felt I might use this action but only when I was going to follow it with a gototask action that would replace the currently viewed script. I must admit that when I first saw the results they weren’t quite as I’d imagined.

        Thanks for your comments about my blog.


      • Many thanks.

        ClearAnswerHistory, not sure but I will investigate.

        When I created this post I thought I’d covered all the actions available. It might be that this has been added at a later release.

        I am away at the MVP summit right now. When I fly home I will look at this and try to document difference between ClearHistory and ClearAnswerHistory

        Liked by 1 person

      • Hi

        I have tried creating a UII action called “ClearAnswerHistory” but I have been unable to use it to clean up the agent scripting history. If you can tell me of any reference you have seen in reference guides I will did deeper.



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

  3. Hello Neil,
    Thank you once again for your very helpful tutorials. I am trying to use Agent Scripts in USD and I am asking my self if there is any way to close an agent script answer (turn it checked) without clicking on it? I just want to trigger an action that makes this step (answer) done.

    Best regards.


    • I haven’t seen a method to actually tick the agent script answers. But on my scripts I have addd conditions so that some answers are either disabled or not visible if they don’t apply. For example, I have one to collect customer contact details. But if all the contact details are present it shows as disabled.


  4. Hi Neil,
    I want to switch the agent script automatically based on the focused tab.
    For example there is a session which contains two tab,my requirement are given below:
    1. If user selects tab1 then agent script related to tab1 should load automatically.
    2. if user switch to tab2 then agent script for tab2 should be automatically loaded.


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 )

Connecting to %s