Unified Service Desk – RunScript Action

2 Comments

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
Keep learning. Keep building.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.

Subscribe on YouTube →
Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert

2 Responses to Unified Service Desk – RunScript Action

  1. Hello Carl,

    Thank you so much for this amazing blog.
    I have one query related to the Action call condition.
    Can I read the value of Hosted control stored on the same record in the action call condition?
    Please let me know if you need more information.

    Thank you.

Leave a Reply

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