Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Help Needed: UI Action Button in List View Not Triggering in ServiceNow Workspace

Shivam Singh1
Tera Contributor

Hi everyone,

I am trying to create a new action in the list view. I have created a new UI action button and written the following script in the UI action:

function onClick() {
   action.setRedirectURL('https://www.youtube.com/');
}

I added this code in the workspace client script and, for safety, included the same code in the normal script. To display this button in the workspace, I created an action assignment and set the implementation as a client script. The button is visible in the workspace, but no action is triggered when I click it.

Action assignment attachment:

ShivamSingh1_0-1741331356596.png

 

 

Ui action attachments:

 

ShivamSingh1_1-1741331139533.png

ShivamSingh1_2-1741331193446.png

 

 

Note: This code is working in the backend view in form and list level

 

Could anyone help me understand why this is happening and how to fix it?

 

Thank you!

In this series i have explained about ServiceNow Discovery right from scratch like how you can enable the discovery plugin, what are the discovery prerequisites, what all question you should ask for your client before start the discovery implementation, how you can configure discovery schedules ...
3 REPLIES 3

Murthy Ch
Giga Sage

@Shivam Singh1 

Try this in workspace script:

function onClick(g_form) {
    top.window.open("https://www.google.com");
}
Thanks,
Murthy

I tried this, but it's not working as expected

Ankur Bawiskar
Tera Patron
Tera Patron

@Shivam Singh1 

action which is server side object won't work in workspace client script

use this code

function onClick(g_form) {
    open("https://www.google.com");
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader