Walkthrough 4: Display a Microsoft Dynamics CRM record in a session in your agent application
This walkthrough demonstrates how to display Microsoft Dynamics CRM records in a session in your agent application using window navigation rules and session controls in Unified Service Desk. It also demonstrates the use of replacement parameters to dynamically display the name of the hosted control based on the currently displayed account record. This walkthrough is built on top of the previous walkthrough, Walkthrough 3: Display Microsoft Dynamics CRM records in your agent application, to display an account record in a session when you click on one of the accounts in the Account search result window.
Prerequisites
You must have completed Walkthrough 1: Build a simple agent application and Walkthrough 3: Display Microsoft Dynamics CRM records in your agent application. The configurations that you completed in these 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 at the end of the walkthrough to test the 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 about the following in Unified Service Desk:
Session Tabs type of hosted control. More information: Session Tabs (Hosted Control)
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 a session-scoped hosted control to display account record in a session
Step 2: Configure the event to close the hosted control from where the search originated
Step 3: Create a Session Tabs hosted control
Step 4: Create a window navigation rule to display the account record in a session
Step 5: Add the controls to the configuration
Step 6: Test the application
Conclusion
Step 1: Create a session-scoped hosted control to display account record in a session
In this step, you’ll create a session-scoped hosted control to display an account record in a session.
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 Account Session
Display Name
[[account.name]]
Note
We will use replacement parameter to dynamically display the name of the selected account as hosted control display name.
USD Component Type
CRM Page
Allow Multiple Pages
No
Hosting Type
Internal WPF
Application is Global
Not checked
Note
This ensures that the hosted control is session-scoped, that is, only displayed in a session.
Display Group
MainPanel
Click Save.
Step 2: Configure the event to close the hosted control from where the search originated
In this step, you’ll configure the BrowserDocumentComplete event on the Contoso Account Session hosted control so that when it’s loaded, the parent hosted control from where the user clicked to open the account, Contoso Accounts Search, is closed. The Contoso Accounts Search hosted control was created in Walkthrough 3: Display Microsoft Dynamics CRM records in your agent application. This is done to ensure that the user can’t open other account information in the same session tab.
On the nav bar, click the down arrow next to the Contoso Account Session hosted control, and 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, click the search icon or press ENTER, and then click New in the lower-right corner of the search results box.
On the New Action Call page, specify the following values.
Field Value Name
Contoso Action Call: Close Accounts Search
Hosted Control
Contoso Account Search
Action
Close
Click Save to add the action call to the BrowserDocumentComplete event.
Step 3: Create a Session Tabs hosted control
To display records in sessions in your agent application, an instance of the Session Tabs type of hosted control must be configured in your agent application.
On the hosted control page, click New.
On the New Hosted Control page, specify the following values.
Field Value Name
Contoso Session Tab
USD Component Type
Session Tabs
Click Save.
Step 4: Create a window navigation rule to display the account record in a session
In this step, you’ll create a window navigation rule that displays the record in a session when the user clicks on any of the accounts in the search results window.
Sign in to Microsoft Dynamics CRM.
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 Account Session Rule
Order
5
From
Contoso Accounts Search
Entity
account
Route Type
Popup
Destination
Tab
Action
Create Session
Target Tab
Contoso Account Session
Show Tab
Contoso Account Session
Hide Command Bar
No
Hide Navigation Bar
Yes
Click Save.
Step 5: Add the controls to the configuration
In this step, you’ll add the action call, event, hosted controls, and window navigation rule 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: Close Accounts Search |
Action call |
BrowserDocumentComplete |
Event for the Contoso Account Session hosted control |
Contoso Account Session |
Hosted Control |
Contoso Session Tab |
Hosted Control |
Contoso 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: Close Accounts Search” in the search bar, and then press ENTER or click the search icon.
In the search result box, click the action call to add it to Contoso Configuration.
Similarly, add the event, hosted controls and window navigation rule by clicking the down arrow next to Contoso Configuration, and clicking EventsHosted Controls and Window navigation Rules respectively.
Click Save.
Step 6: 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.
To display the account records from your CRM instance, click the down arrow next to the Search button in the toolbar, and then click Account.
Click any of the account records to display the respective account information in a session; the information is displayed under a session tab. Note that the name of the hosted control tab that contains the account record automatically displays the account name because earlier you used replacement parameters to dynamically display the current account name instead of a static value.
If you open another account record, it will be displayed in another session in your client application. To open another account, click the down arrow next to the Search button, click Account, and then click an account name to display the account information in another session.
Conclusion
In this walkthrough, you learned how to use the session hosted control and window navigation rules to display CRM records in a session in your agent application. You also learned how to filter access to Unified Service Desk controls using configuration.
Note
Try the next walkthrough to present enhanced session information in your agent application: Walkthrough 5: Display enhanced session information by displaying session name and overview data.
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 6: Configure the Debugger hosted control in your agent application
Walkthrough 7: Configure agent scripting 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.