USD Toolbar Button Visibility and Replacement Parameter Logic

1 Comment

In Unified Service Desk, we can use Toolbar buttons to perform actions in the application. For example here we have toolbar buttons in the main application:

Now let’s say we want to hide and show these buttons based on certain values. For example, if the user is based in the US, and the Maps application is loaded, we may want to show a button that allows us to open a navigation app specific to this environment. We would not want to show this button to users that are in a different region who may have their own software.

To do this, let’s first create a new toolbar button in the main toolbar:

Go to the visible condition:

We will need replacement parameters to help with the code here. Open the USD Debugger and copy the replacement parameters for the Bing Maps URL and the Country Address:

Let’s form our expression as:

"[[Bing Map New.url]g]" != "" && "[[systemuser.address1_country]g]" == "US"

Now let’s open USD. We see the new button for this user:

And if a user that is not in the US opens the USD, we don’t see the button:

In some cases, you will want to use the + replacement key to replace a null replacement parameter with a blank string. If you don’t do this, the condition will fail.

Note you can use this logic in other areas such as if the button is enabled or not.

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

One Response to USD Toolbar Button Visibility and Replacement Parameter Logic

  1. Hi carl,
    This article is very helpful thanks
    Can you help me with how to visible condition for different pagetype.

    My requirement is I want to show toolbar button fir pagetype=entityrecord not for entitylist

Leave a Reply

Your email address will not be published. Required fields are marked *