USD – Agent Script (Linked Tasks)

Unified Service Desk (USD) for Microsoft Dynamics CRM contains the capability of creating agent scripts. Typically, I logically associate one agent script with one hosted control. There are however times when you need the scripting to be more granular. Let’s look at an example and how linked tasks can help.

In my application it was decided that recording any missing details for a contact was an important step to include in the agent script. This could have been achieved by adding multiple answers to the main contact agent script. But that could have made that script quite long.

Instead I wanted one answer that was “Enter missing contact details” and then let that answer link to another script with several other answers for specific pieces of information. Plus, I’d need a way to navigate back to the main script once the missing pieces of information had been entered.

I hope this functionality will serve as a good example of one way linked tasks might be useful in agent scripts.

Below you can see how my agent script has an answer of “Enter missing contact details”. Notice that my contact is missing a business phone number! I have actually written this that the answer to enter missing details will not be enabled if all details are present and correct.

When I click “Enter missing contact details”, a second agent script is displayed. This script encourages entry of mobile number, business phone and email. (I could have added more fields; this is just an example!) As mobile number and email are already populated those options are not enabled. Clicking on “Enter business phone” will set focus to the correct phone number field on the contact form.

I also have an option “RETURN TO CONTACT SCRIPT”, as the name suggests selecting this option will return the navigation to the original script.

The steps involved in this change were as follows;

  1. Create some actions to set focus.
  2. Create an agent script called “Capture Contact Details”.
  3. Create an answer called “Enter missing contact details”.
  4. Add answers of the “Capture Contact Details” agent script.
  5. Add answer to RETURN.

Step One – Create some actions to set focus.

For each of the fields I want to capture I wanted an action to set focus. So that when the option to enter email (etc) was selected that the user was positioned on that field.

I have shown an example for email below. I actually created three of these actions. One for mobile, one for business phone and one for email.

Field Details
Name Contact – RunXrmCommand (Setfocus <<field name>>)
Hosted Control This was “Contact”, as that is the name of the hosted control I use for my contact entity.
Action RunXrmCommand
Data The data field contains the command I need to set focus.

Xrm.Page.ui.controls.get(“<<field name>>”).setFocus();

Step Two – Create an agent script called “Capture Contact Details”.

At this point I created a new agent script called “Capture Contact Details”. Initially I just created the script and saved it. We will add some answers to this in a second!

I entered script text and instructions; these are simply free text. You can enter whatever you like!

Step Three – Create an answer called “Enter missing contact details”.

I already had an agent script on contact. If you haven’t got one, you’ll need to create one. (Sorry, I am assuming here that you understand the basics of creating an agent script!) My answer looked like this.

I did this step after creating the capture contact details script as I wanted to link to that!

Field Details
Name Collect Contact Details (Contact)
Answer Text “Enter missing contact details”
Linked Task Capture Contact Details, this is the name of the agent script I’d already created to capture missing details.
Show Tab Contact (As I’m working with the contact tab!)
Enable Condition “[[contact.mobilephone]+]”==”” || “[[contact.telephone1]+]”==”” || “[[contact.emailaddress1]+]”==””

This line saying that if mobile phone OR business phone OR email address are blank that enable this option.

Step Four – Add answers of the “Capture Contact Details” agent script.

I now went back to my capture contact details script and started adding answers. Initially three answers, one to enter missing mobile, one for business phone and another for email address.

Field Details
Name Capture Contact Details – Mobile Phone.

I also had “Capture Contact Details – Business Phone” and “Capture Contact Details – Email”.

Answer Text Enter mobile phone (etc.)

Keep in mind that the answer text is seen by the operator but the name isn’t!

Linked Task Capture Contact Details, as all of these answers are linked to the agent script called “Capture Contact Details”
Show Tab Contact
Enable Condition “[[contact.mobilephone]+]”==””

This means, only enable the answer if the mobile phone number was blank.

Business phone looked like: “[[contact.telephone1]+]”==””

Email look like: “[[contact.emailaddress1]+]”==””

On each of the answers I also added one of the actions I created in step one. So that focus would be given to an appropriate field when an option is selected.

Step Five – Add answer to RETURN

I next needed an approach to get back to the script that called this one! As after entering the missing contact details the operator may need to handle other queries for this contact.

Field Details
Name Capture Contact Details – RETURN
Linked Task Contact – Agent Script

As I added this answer from the Capture Contact Details script it would have defaulted to that. But I changed the value here to point to the script associated with my contact.

This was all that was needed to get the contact script to be displayed when this answer is clicked.

Show Tab Contact

Finally, my answers looked like this …. Notice the order as that will drive the order they show in the screen.

I hope this example has shown you how you can use the linked task option to link to one agent script from another. Hopefully you can adapt this idea for your own purposes.

3 thoughts on “USD – Agent Script (Linked Tasks)

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

  2. Hello sir, thank your for all your infromations about USD,
    i want to qualify /and disqualify a lead from an action in agent script, its possible or i must create a custom Hosted control, thank you for your answer


    • Hi Yosra

      Great question. In my USD application qualification of a lead is done using the standard qualify button on the lead form. I use that as when we qualify the lead it will open the opportunity and potentially also create a contact and account. Plus move the business process forward.

      In my USD solution I load the opportunity, close the lead and also load the contact / account. I find it works quite nicely to open all three records automatically.

      I guess, you could update the lead from an agent script to change its status. But I avoided this because of all the other “stuff” that happens when we click qualify on the lead.

      Would my approach work for you? If not, please give me more details on what you are trying to achieve.




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 )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s