USD – Setting Hosted Control and Panel Size

2 Comments

In Unified Service Desk, you can set the size of a hosted control by calling SetSize and SetVisualProperty.

For example, if we launch USD and start a session, we can see the size of the Agent Script hosted control below:

Let’s say we didn’t want the control and panel to take up as much space in USD.

To do this, we can do 2 things:

  1. Set the size of the panel that the hosted control is in
  2. Set the size of the hosted control

To set the size of the panel, we first need to know the panel name. In our case, the control runs in the RightPanel. The easy way to find this is to look at the hosted control setup:

Next, go to the Event that opens the agent script. In our case, we have it running on BrowserDocumentComplete of the Incident hosted control:

We will add a new action to set the width of the panel above on the CustomPanel hosted control. We will do this using SetVisualProperty. We will set the Data field to below:

Elementname=RightPanel
Propertyname=Width
Value=200

If we run this now, we will see the agent script control load in a smaller right panel width:

Next, we will set the size of the hosted control using SetSize. Create a new action right after the action we just created, like below. We will call this on the Agent Script hosted control using the SetSize action to set the width to 100:

Our events should now look like this:

When we run this, we can see the hosted control is smaller than the panel:

 

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

 

2 Responses to USD – Setting Hosted Control and Panel Size

  1. why am I getting unnecessary margin between Right Panel and Main Panel? Is it because of expander ? I have also tried your other solution using splitter but the margin is increasing exponentially.

Leave a Reply

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