USD – Stop User from Closing a Tab

Leave a comment

In Unified Service Desk, hosted controls have a property to allow the user to open and close the control. In some cases, you may want to control this so the user does not have this option.

Below, I have a hosted control that displays a Dynamics 365 dashboard. You can see there is an X in the hosted control tab, which when clicked on allows the user to close the tab:

If we look in USD configuration, we can see this control has User Can Close checked, i.e. set to Yes:

If we uncheck this option, we can see the control no longer has this X:

However, not all hosted controls have this option. Some controls do not display the option for User Can Close, and give the user the option to close or not close. To hide this option, we would need to add an action to prevent the user from closing the control.

To do this, go to the event where the control is loaded. My dashboard is loaded when USD starts in the DesktopReady event:

Add a new action and call SetUserCanClose. Set this to true or false:

We now have 2 actions, one to open the control, and the other to set the property so it cannot be closed:

As can be seen, the control now does not display the X:

 

 

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 *