USD – Multiple Tabs and ScanForDataParameters

Within Unified Service Desk (USD) for Microsoft Dynamics 365 typically each entity in a session loads into one tab but we can use the allow multiple pages option to hold several pages in one tab. However, the data we will be holding will always be the last record loaded into the tab.

In many circumstances this is fine. But what if you have an agent script that runs on whatever case is selected. It is actually going to run on the last one loaded not the selected one. This can cause confusion with users! (Or worse, I could accidently create cases for the wrong customer etc.)

If you haven’t used the multiple tabs option before than I write about them here.

To resolve this “issue” what we need to do is scan for updated replacement parameters each time the content of the tab is changed. But how do we know the selection has changed and how do we avoid accidently loading the tab! (Because if we scan for data parameters and the tab isn’t open it will open!)

The solution to this issue turned out to be quite simple …. Lets look at an example.

In my USD solution I can open multiple live assist chat activities in a tab. I will use this the basis for my example. But we could be looking at a tab that supports multiple phone calls, cases or anything. The approach would be the same.

The steps involved are;

  1. Create an event (if you haven’t got it)
  2. Create an action.
  3. Add the action to your event.

Step One – Create an Event

The first thing we need is an event that will be triggered each time the chat activity being displayed is changed. Actually the event in question will be triggered every time any tab in my session is changed!

Navigate to your panel layout hosted control. Mine is called “Main Layout” yours could be called “Custom Layout”, “Panel Layout” etc!

Now under events check you have an event called “SelectedAppChanged”. If you don’t have this event simply click the “ADD NEW EVENT” button and add it.

Step Two – Create an Action

Now we need an action that will scan for changes in data parameters, mine is shown below;

Importantly my action also has a condition;

The details of my action are below;

Field Description
Name CRM Global Manager – Call Do Action (on Selected App Changed)

You could use any name!

Order I didn’t care!
Hosted Control CRM Global Manager

The name of my global manager!

Action CallDoAction
Data application=Related Chat Activity


The application will need to be set to the name of whatever tab you want to work with. Yours might be called “Case”, “Phonecall” etc etc.

“action” is set to the event we just created, “ScanForDataParameters”.

Condition “[[Selection]]”==”Related Chat Activity” && “[[Related Chat Activity.HostedControlStatus]+]”==”open”

This condition is firstly checking that “my” tab has been selected. (I don’t want to do this on every tab!). Then I check that my tab is already open, as I don’t want to trigger it loading if it isn’t open.

Step Three – Add The Action to Your Event

The final step is simple, we simply add our newly created action to the event we created earlier. As shown below.

Now each time the tab containing my related chat activities is changed the replacement parameters will be updated. Meaning any agent scripts or toolbar buttons would be running against the record the user is currently looking at not the last one loaded. You can see this highlighted from my debugger output below. Notice that the action doesn’t run when I selected a contact or account. But does fire when I change the selected Related Chat Activity. (Plus checking my replacement parameters after each change confirms that are correctly updating as expected.)

A simple change but one I hope you agree will be quite useful when using multiple tabs.

2 thoughts on “USD – Multiple Tabs and ScanForDataParameters

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

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s