USD Toolbar Button Visibility and Replacement Parameter Logic

Leave a 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.

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, BI, Web, Cloud and Data Science.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

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