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:
- Set the size of the panel that the hosted control is in
- 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: