USD – PING/PONG (CloseSession)

I recently published a quick post to describe how to close all sessions from a single button click in Unified Service Desk (USD). You can view that post here. In this post I will describe a more elegant approach.

I take no credit for coming up with this idea. A very good friend of mine suggested this approach having read my original post. His name is Naga Srikanth Alluri. Srikanth is married to another friend of mine called Rashi. It was Srikanth who introduced me to USD and Rashi who taught me how to use it. I owe these guys so much. J

But what is this “PING/PONG” thing I hear you ask ….

In my original post, I simply ran one action after another. It was fine if you restricted the maximum number of open sessions to a fixed number but if you didn’t the approach wasn’t elegant. In this revised approach we will use just two actions.

PING/PONG Action Name Hosted Control Action Condition Sub Action
PING Session Tabs – Close Session (PING) Session Tabs CloseSession [[$Session.Count]g]>0 Session Tabs – Close Session (PONG)
PONG Session Tabs – Close Session (PONG) Session Tabs CloseSession [[$Session.Count]g]>0 Session Tabs – Close Session (PING)

I hope you can see that we create a “kind of” loop, with the first action calling the second. And the second calling the first. Meaning the condition is important to break out of the loop.

Steps Involved are ….

  1. Create PING action
  2. Create PONG action
  3. Set sub-actions on PING and PONG
  4. Add an action to a toolbar.

Step One – Create PING Action

Srikanth’s ping action looked like this. So not forget the condition! You will dive into an endless loop if you miss it!!

Step Two – Create PONG Action

This is going to be exactly the same as my ping. Again, don’t forget the condition!

Step Three – Set sub-actions on PING and PONG

Now you need to access the sub actions on these two actions. The PING will have a sub action of the PONG. And the PONG will have a sub-action of PING.

This process simply involves opening the Sub Action Calls option.

And adding in either PING or PONG!

Step Four – Add an Action to a Toolbar

Finally, we need to add the PING action into a toolbar button.

Below you can see my toolbar button.

I’ve given it am image called CloseQuote_16. I found this in the image resources in the Dynamics 365 SDK. You could use another image or leave blank.

Notice my enable and visible conditions. I added this as I only wanted the button to show when I have 2 or more sessions open. [[$Session.Count]g]>1

My button finally looked like this. Notice I have two sessions open which is why the button is showing.

Thanks again Srikanth. This is a great approach to this problem and shows us how we can have a “loop” in USD.

2 thoughts on “USD – PING/PONG (CloseSession)

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

  2. Pingback: Active time in a Tab – Display Timer | CRM Ramblings

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 )

Facebook photo

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

Connecting to %s