Unified Service Desk – RunScript Action

Leave a comment

In Unified Service Desk, there is a RunScript action that allows us to run JavaScript within USD.

Let’s say we want to do something simple such as displaying an alert “Hello World” when opening a hosted control.

On loading our hosted control “Dashboard”, which is of type Unified Interface Page, we will add an action to display our message.

Go to Settings->Unified Service Desk and click Hosted Controls:

Open Incident:

Select Events:

We will open the PageReady event:

Click + to add an action:

We will select the hosted control and the RunScript action. Here we will simply add some JavaScript into the data:

Note the description of the action – “Injects JavaScript in the main frame of the hosted control.   You should avoid using Microsoft Dynamics 365 client SDK calls with this action; instead, use the RunXrmCommand action.”

Be sure to add the action on to the event after saving it:

Now start USD. When the incident control finishes loading, we will see our message:

Note you can also call by creating a function and invoking the function right away to produce the same result:



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

carldesouza.comLinkedIn Twitter | YouTube


Leave a Reply

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