USD – Close All Sessions

I recently answered a question someone raised in the Dynamics Community on how to close all the currently open sessions in Unified Service Desk (USD)  with one click. This is a very simple change to implement, this post explains how.

I am going to assume you already understand how to open sessions!

The steps involved are;

  1. Create some actions.
  2. Create a toolbar button.

Step One – Create some actions.

First of all I created 5 actions. Why 5? Well my maxNumberOfSessions option is set to 5. If yours if higher or lower than you’ll need a different number of actions.

Each action looked something like the one shown below. The hosted control is “Session Tabs” and the action is “CloseSession”.

Notice the Order field. I had this set so that each action would happen one after another.

Step Two – Create a Toolbar Button.

Next I created a toolbar button and added the five actions I’d created to that button. My button looked like this;

Some things to note;

  • I called my button “CTI Toolbar – Close”, as I added this to a toolbar I was showing in my CTI Toolbar. You could obviously add yours to you main toolbar if you’d prefer.
  • I uploaded a suitable image as a webresource. Its name was “crm_CloseQuote_16”. I “borrowed” it from the images that come in the Dynamics 365 SDK! (This step is optional.)
  • I added all my actions, you can see that the order field gave them a logical sequence.
  • I added an enable and visible condition. As I only wanted a close sessions button to show when a session was open. My condition was “[[$Context.LogicalName]+]”!=”” (FYI, other conditions might have worked I just opted to look for the presence of an entity name in my context, as I will always have that when a session is open.)

My button finally looked like this ….

I hope you can see this is a dead simple change but one that might be useful.

6 thoughts on “USD – Close All Sessions

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

  2. Pingback: USD – PING/PONG (CloseSession) | Microsoft Dynamics CRM and Unified Service Desk

  3. Pingback: USD – PING/PONG (CloseSession) - Microsoft Dynamics CRM Community

  4. Hi Neil,

    I follow your blog for USD and everything I know I have learnt from here, you are really doing a great job. I would like to ask a question with regards on USD. I have a getnext button that gets the next case from a queue and assigns it to an agent. The getnext code is in javascript and a web resource was created. I am struggling to create a session when the getnext is clicked and I have no errors on the navigation rule. Please help.


    • Thanks Mariah

      I assume your button has some JavaScript that queries this next case and then does something like to open the case.

      First of all, double check it works outside of USD.

      Assuming the case is opening in a new tab, you will need navigation rule that is triggered when a pop up happens from your case tab in USD for the incident entity. If that fails, try an in place route! (But I think it would be a pop up.)

      If you continue to get issues try looking at the events in the debugger as you might be able to workn


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