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

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.

  1. Sign in to Microsoft Dynamics CRM.

  2. Go to Settings > Unified Service Desk. (How do I get there?)

  3. Click Hosted Controls.

  4. Click New.

  5. 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

    Create a session-scoped hosted control

  6. 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.

  1. On the nav bar, click the down arrow next to the Contoso Account Session hosted control, and click Events.

    Configure events for a hosted control

  2. On the events page, click BrowserDocumentComplete.

  3. On the BrowserDocumentComplete page, click + in the Active Actions area to add an action call to the event.

  4. 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.

    Add an action call to an event

  5. 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

    Create an action call in Unified Service Desk

  6. 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.

  1. On the hosted control page, click New.

  2. On the New Hosted Control page, specify the following values.

    Field Value

    Name

    Contoso Session Tab

    USD Component Type

    Session Tabs

    Create a Session Tabs hosted control

  3. 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.

  1. Sign in to Microsoft Dynamics CRM.

  2. Go to Settings > Unified Service Desk. (How do I get there?)

  3. Click Window Navigation Rules.

  4. Click New.

  5. 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

    Create a window navigation rule

  6. 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:

  1. Sign in to Microsoft Dynamics CRM.

  2. Go to Settings > Unified Service Desk. (How do I get there?)

  3. Click Configuration.

  4. Click Contoso Configuration to open the definition.

  5. On the nav bar, click the down arrow next to Contoso Configuration, and select Action Calls.

  6. 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.

  7. In the search result box, click the action call to add it to Contoso Configuration.

  8. 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.

  9. Click Save.

Step 6: Test the application

  1. 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.

  2. 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.

  3. 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.

    Account record displayed in a session

  4. 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.

    Multiple sessions in Unified Service Desk

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.