I recently received a great question about agents scripts and I love answering Unified Service Desk questions! This time the question was about a requirement to switch agents scripts. Here is my answer.
The question I received is shown below;
So essentially this person has multiple agent scripts and as tabs are selected wants to automatically show the agent script that relates to the selected tab. This seemed quite a logical thing to want to achieve, when looking at my case I’d like to see the agent script that relates to answers associated to the case. But if I also had an opportunity open then the agent script should automatically switch to be focused on opportunity when the user clicks on the opportunity tab.
I did manage to achieve this effect, although there were a couple of minor things to be aware of. In the rest of this post I will explain how I answered this problem;
The simple steps involved are;
- Create a SelectedAppChanged event, if you don’t already have one.
- Create some Agent Script GotoTask actions.
- Associate the GotoTask actions with SelectedAppChanged event.
Step One – Create a SelectedAppChanged event
You will have a hosted control of type “PanelLayout”. Mine is called “Main Layout”. Other common names might be “Custom Panel Layout” etc.
Find your panel layout hosted control and open its associated events view. You need to check you have an event called “SelectedAppChanged”. If you do great. If you don’t simple click “ADD NEW EVENT” and create one.
Step Two – Create some Agent Script GotoTask actions
Next you will need an action to load each of the agent scripts you want to enable this automatic switching feature on. You can see below that I decided to apply this logic to four of my tabs. Account, Contact, Case and Opportunity.
You will no doubt have a different naming convention to me, so may need to take that into account.
My hosted control for accounts is called “Account”, cases is called “Cases” etc. (Fairly typical.)
My agent script for accounts is called “Account – Agent Script”, cases is called “Case – Agent Script” etc.
Knowing this let’s look at one of my actions in a little more detail. I will use my action for the account hosted control as an example, I hope you can see how these might vary for each tab.
Field | Details |
Name | Agent Scripting – Goto Task (Account, When Selected) |
Hosted Control | Agent Scripting |
Action | GotoTask |
Data | Account – Agent Script Obviously the name you have here will probably be different to mine. But this is simply the name of the script I want to show when my Account tab is selected. |
Condition | “[[Selection]+]”==”Account” && “[[Agent Scripting.msdyusd_name]+]”!=”Account – Agent Script” This condition (importantly) checks two things.
|
Step Three – Associate the GotoTask actions with SelectedAppChanged event
The final step was to simply add my actions to the SelectedAppChanges event. You can see below that I added all four of my actions.
Hopefully I have managed to answer the question and maybe given you an idea on how to enhance your agent scripts.
Hi Neil,
I tried this approach but it is not working at all..:(
LikeLike
Hmmm …. works fine for me! Please explain what isn’t working and I will try to help.
LikeLike
You have shared a wonderful article, Neil.
LikeLiked by 1 person