Walkthrough 4: Display a record in a session in your agent application
This walkthrough demonstrates how to display 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 records in your agent application, to display an account record in a session when you select 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 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: 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 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 the Dynamics 365 instance.
Go to Settings > Unified Service Desk.
Select Hosted Controls.
Select 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 Select 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 selected to open the account, Contoso Accounts Search, is closed. The Contoso Accounts Search hosted control was created in Walkthrough 3: Display 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, select the down arrow next to the Contoso Account Session hosted control, and select Events.
On the events page, select BrowserDocumentComplete.
On the BrowserDocumentComplete page, select + in the Active Actions area to add an action call to the event.
In the search box, select the search icon or press ENTER, and then select 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 Select 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, select New.
On the New Hosted Control page, specify the following values.
Field Value Name Contoso Session Tab USD Component Type Session Tabs Update the XML in the Extensions XML field. To learn more, see Chat indicator XML.
Select 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 selects any of the accounts in the search results window.
Sign in to the Dynamics 365 instance.
Go to Settings > Unified Service Desk.
Select Window Navigation Rules.
Select 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 Select 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 the Dynamics 365 instance.
Go to Settings > Unified Service Desk.
Select Configuration.
Select Contoso Configuration to open the definition.
On the nav bar, select the down arrow next to Contoso Configuration, and select Action Calls.
On the next page, select Add Existing Action Call, type “
Contoso Action Call: Close Accounts Search
” in the search bar, and then press ENTER or select the search icon.In the search result box, select the action call to add it to Contoso Configuration.
Similarly, add the event, hosted controls and window navigation rule by selecting the down arrow next to Contoso Configuration, and selecting Events Hosted Controls and Window navigation Rules respectively.
Select Save.
Step 6: Test the application
Start the Unified Service Desk client application, and sign in to the Dynamics 365 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 Dataverse instance using the Unified Service Desk client application, see Connect to CRM instance using the Unified Service Desk client.
To display the account records from your Dataverse instance, select the down arrow next to the Search button in the toolbar, and then select Account.
Select 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, select the down arrow next to the Search button, select Account, and then select 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 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
Walkthrough 1: Build a simple agent application
Walkthrough 2: Display an external webpage in your agent application
Walkthrough 3: Display 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