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:

 

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 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 *