Walkthrough 7: Configure agent scripting in your agent application
Agent scripting in Unified Service Desk helps to guide your agents during customer interaction. This walkthrough demonstrates how to create a simple agent script that helps the agents quickly create a new case for an account or browse existing cases from the agent application. The agent script created in this walkthrough is invoked when the agent pulls up an account record to view, which is displayed in a session in the Unified Service Desk client. The script provides the following three options:
Create a case for the current account
Display existing cases for the current account
Close the session
Prerequisites
You must have completed Walkthrough 1: Build a simple agent application and Walkthrough 4: Display a Microsoft Dynamics CRM record in a session in your agent application. The configurations that you completed in those walkthroughs are required in this walkthrough.
This walkthrough assumes that you’ll be using the same user credential that you used in walkthrough 1 to sign in to the agent application. If a different user will be testing the application, you must assign the user to Contoso Configuration. More information: Walkthrough 1: Build a simple agent application
You must know be familiar with the following concepts in Unified Service Desk:
Agent Scripting type of hosted control and how to configure agent scripts. More information: Agent Scripting (Hosted Control) and Guide customer interactions with agent scripts
How to configure Action calls
How to configure window navigation rules. More information: Use window navigation rules in Unified Service Desk
Filter access using Unified Service Desk configuration. More information: TechNet: Manage access using Unified Service Desk configuration
In This Walkthrough
Step 1: Create an Agent Scripting type of hosted control
Step 2: Create hosted controls to display the new case form and existing cases
Step 3: Create an agent script task
Step 4: Add the answer, action call, and window navigation rule for creating a case from the agent script
Step 5: Add the answer and action calls for displaying existing cases
Step 6: Add the answer and action calls for closing the session
Step 7: Create an action call to display the agent script
Step 8: Display the agent script when the account record is displayed in a session
Step 9: Add the controls to the configuration
Step 10: Test the application
Conclusion
Step 1: Create an Agent Scripting type of hosted control
An instance of the Agent Scripting type of hosted control must be available in your agent application to display agent scripts.
Sign in to Microsoft Dynamics CRM.
Go to Settings > Unified Service Desk. (How do I get there?)
Click Hosted Controls.
Click New.
On the New Hosted Control page, specify the following values.
Field Value Name
Contoso Agent Scripting
USD Component Type
Agent Scripting
Display Group
WorkflowPanel
Click Save.
Step 2: Create hosted controls to display the new case form and existing cases
In this step, you’ll create two hosted controls of CRM Page type to display the new case creation form and existing cases for the current account.
On the hosted controls page, click New.
On the New Hosted Control page, specify the following values:
Field Value Name
Contoso new case form
Display Name
New Case
USD Component Type
CRM Page
Allow Multiple Pages
No
Hosting Type
Internal WPF
Application is Global
Not checked
Display Group
MainPanel
Click Save.
On the hosted controls page, click New to create another hosted control.
On the New Hosted Control page, specify the following values:
Field Value Name
Contoso existing cases for an account
Display Name
Cases for [[$Context.name]]
Note
We are using the replacement parameter to dynamically display the name of the current account from the execution context as the hosted control display name.
USD Component Type
CRM Page
Allow Multiple Pages
No
Hosting Type
Internal WPF
Application is Global
Not checked
Display Group
MainPanel
Click Save.
Step 3: Create an agent script task
Create an agent script task to display when an account record is displayed in a session.
Sign in to Microsoft Dynamics CRM.
Go to Settings > Unified Service Desk. (How do I get there?)
Click Agent Scripts.
Click New.
On the New Agent Script Task page, specify the following values:
Field Value Name
Contoso: Welcome to Account Session
Start Task
No
ScriptText
Welcome [[$Context.name]]. My name is [[$User.firstname]]. Is this call regarding a new or an existing service request?
Note
We are using replacement parameters to dynamically display the account name and the current agent’s name to the agent at runtime.
Instructions
Based on the customer response, click one of the tasks below.
Click Save to create the agent script.
Step 4: Add the answer, action call, and window navigation rule for creating a case from the agent script
In this step, you’ll create answer, action call, and window navigation rule for displaying a new case form with some prepopulated values from the currently active account record.
In the Answers area of the agent script task that you created in step 4, click + to create answer.
In the search box, press ENTER or click the search icon, and then click New in the search results box.
On the New Agent Script Answer page, specify the following values:
Field Value Name
Contoso: New case
Answer Text
Create a case
Linked Task
Contoso: Welcome to Account Session
Order
1
Click Save.
Next, add an action call to this answer to display a new case form for the account when the agent clicks this answer. On the nav bar, click the down arrow next to Contoso: New case, and select Actions.
On the next page, click Add Existing Action Call.
In the search box, press ENTER or click the search icon, and then click New to create an action call.
On the New Action Call page, specify the following values:
Field Value Name
Contoso Action Call: Create Case
Order
1
Hosted Control
Contoso new case form
Action
New_CRM_Page
Data
LogicalName=incident
customerid=EntityReference([[$Context.InitialEntity]],[[$Context.Id]])
customeridname=[[$Context.name]]
primarycontactid=[[$Context.primarycontactid.id]+]
primarycontactidname=[[$Context.primarycontactid.name]+]Note
The new case form will be populated with the current account record data to help the agent quickly create a case for the customer.
Click Save.
Next, create a window navigation rule to display the new case form. Go to Settings > Unified Service Desk. (How do I get there?)
Click Window Navigation Rules.
Click New.
On the New Window Navigation Rule page, specify the following values.
Field Value Name
Contoso New Case for Account Session Rule
Order
20
From
Contoso new case form
Entity
incident
Route Type
Popup
Destination
Tab
Action
Route Window
Target Tab
Contoso new case form
Show Tab
Contoso new case form
Hide Command Bar
No
Hide Navigation Bar
Yes
Click Save.
Step 5: Add the answer and action calls for displaying existing cases
In this step, add answer and action calls for displaying existing cases for the current account.
In the Answers area of the Contoso: Welcome to Account Session agent script, click + to create an answer.
In the search box, press ENTER or click the search icon, and then click New in the search results box.
On the New Agent Script Answer page, specify the following values.
Field Value Name
Contoso: Existing cases
Answer Text
Display existing cases
Linked Task
Contoso: Welcome to Account Session
Order
2
Click Save.
Next, add an action call to this answer to display the existing cases for the current account. On the nav bar, click the down arrow next to Contoso: Existing Cases, and select Actions.
On the next page, click Add Existing Action Call.
In the search box, press ENTER or click the search icon, and then click New to create an action call.
On the New Action Call page, specify the following values:
Field Value Name
Contoso Action Call: Display Existing Cases
Order
1
Hosted Control
Contoso existing cases for an account
Action
AssociatedView
Data
navItemName=Cases
Id=[[$Context.Id]]
type=[[$Context.etc]]
tabset=areaServiceClick Save.
Add another action call to set the focus on the new case form. On the New Action Call page, specify the following values:
Field Value Name
Contoso Action Call: Set Focus on Existing Cases
Order
2
Hosted Control
Contoso Global Manager
Action
ShowTab
Data
Contoso existing cases for an account
Click Save.
Step 6: Add the answer and action calls for closing the session
In this step, add answer and action calls for closing the current session.
In the Answers area of the Contoso: Welcome to Account Session agent script, click + to create an answer.
In the search box, press ENTER or click the search icon, and then click New in the search results box.
On the New Agent Script Answer page, specify the following values:
Field Value Name
Contoso: Close session
Answer Text
Close session
Linked Task
Contoso: Welcome to Account Session
Order
3
Click Save.
Next, add an action call to this answer to close the session. On the nav bar, click the down arrow next to Contoso: Close session, and select Actions.
On the next page, click Add Existing Action Call.
In the search box, press ENTER or click the search icon, and then click New to create an action call.
On the New Action Call page, specify the following values.
Field Value Name
Contoso Action Call: Close Session
Hosted Control
Contoso Session Tab
Note
The Contoso Session Tab hosted control was created in Walkthrough 4: Display a Microsoft Dynamics CRM record in a session in your agent application.
Action
CloseSession
Data
sessionid=[[$Context.SessionId]]
Click Save.
Step 7: Create an action call to display the agent script
In this step, create an action call to display the agent script.
Sign in to Microsoft Dynamics CRM.
Go to Settings > Unified Service Desk. (How do I get there?)
Click Action Calls.
Click New.
On the New Action Call page, specify the following values.
Field Value Name
Contoso Action Call: Load Agent Script
Hosted Control
Contoso Agent Scripting
Action
GoToTask
Data
Contoso: Welcome to Account Session
Click Save.
Step 8: Display the agent script when the account record is displayed in a session
In this step, add the action call created in the previous step to the BrowserDocumentComplete event on the Contoso Account Session hosted control so that after it’s loaded, the action call is executed to load the agent script. The Contoso Account Session hosted control was created in Walkthrough 4: Display a Microsoft Dynamics CRM record in a session in your agent application.
Sign in to Microsoft Dynamics CRM.
Go to Settings > Unified Service Desk. (How do I get there?)
Click Hosted Controls.
Search for the Contoso Account Session hosted control, and click it to open the hosted control definition.
On the nav bar, click the down arrow next to Contoso Account Session, and then click Events.
On the events page, click BrowserDocumentComplete.
On the BrowserDocumentComplete page, click + in the Active Actions area to add an action call to the event.
In the search box, type “Contoso Action Call: Load Agent Script”, and press ENTER or click the search icon.
In the search results, click Contoso Action Call: Load Agent Script to add it.
Click Save.
Step 9: Add the controls to the configuration
In this step, add the action calls, agent script, hosted controls, and window navigation rule that you configured in this walkthrough to Contoso Configuration to display these controls to the user who is assigned to the configuration. Contoso Configuration was created in Walkthrough 1: Build a simple agent application.
Add the following to Contoso Configuration.
Control name | Control type |
---|---|
Contoso Action Call: Create Case |
Action call |
Contoso Action Call: Display Existing Cases |
Action Call |
Contoso Action Call: Set Focus on Existing Cases |
Action Call |
Contoso Action Call: Close Session |
Action Call |
Contoso Action Call: Load Agent Script |
Action Call |
Contoso: Welcome to Account Session |
Agent Script |
Contoso Agent Scripting |
Hosted Control |
Contoso new case form |
Hosted Control |
Contoso existing cases for an account |
Hosted Control |
Contoso New Case for Account Session Rule |
Window navigation rule |
To add a control to the configuration:
Sign in to Microsoft Dynamics CRM.
Go to Settings > Unified Service Desk. (How do I get there?)
Click Configuration.
Click Contoso Configuration to open the definition.
On the nav bar, click the down arrow next to Contoso Configuration, and select Action Calls.
On the next page, click Add Existing Action Call, type “Contoso Action Call” in the search bar, and then press ENTER or click the search icon.
Select the five action calls from the search results box to add them to Contoso Configuration.
Similarly, add the agent script, hosted controls, and window navigation rule by clicking the down arrow next to Contoso Configuration, and clicking Agent ScriptsHosted Controls and Window navigation Rules respectively.
Click Save.
Step 10: Test the application
Start the Unified Service Desk client application, and sign in to the CRM instance where you configured Unified Service Desk by using the same user credentials that is assigned to Contoso Configuration in Walkthrough 1: Build a simple agent application. For information about connecting to a CRM instance using the Unified Service Desk client application, see TechNet: Connect to CRM instance using the Unified Service Desk client
Click the down arrow next to the SEARCH button in the toolbar, and then click Account to display the account records from your CRM instance.
Click the expander to display the left pane.
Click on any of the account records to display the respective account information in a session. In the left pane, the Contoso: Welcome to Account Session agent script appears.
In the agent script:
Click New case to open a new case form with pre-populated values (in the red box) from the current account record.
Click Display existing cases to display the associated cases for the current account record.
Click Close session to close the current session.
Conclusion
In this walkthrough, you learned how to configure a simple agent script to guide your call center agents. Unified Service Desk allows you to create more complex scripts with branching logic that contain child answers and actions. You also learned how to filter access to Unified Service Desk controls using configuration.
See Also
Tasks
Walkthrough 1: Build a simple agent application
Walkthrough 2: Display an external webpage in your agent application
Walkthrough 3: Display Microsoft Dynamics CRM records in your agent application
Walkthrough 4: Display a Microsoft Dynamics CRM record in a session in your agent application
Walkthrough 5: Display enhanced session information by displaying session name and overview data
Walkthrough 6: Configure the Debugger hosted control in your agent application
Other Resources
Unified Service Desk configuration walkthroughs
Unified Service Desk
Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.