Open URL in new browser window using UI Action in Custom Scoped Application - Jakarta

Lon Landry2
Tera Contributor

I am trying to open the URL for a Knowledge Article (KA) in new browser window using a UI Action in Custom Scoped Application - Jakarta

action.setRedirectURL works fine; but opening in a new window is required...

window.open('https://devXXXXX.service-now.com/kb_view.do?sysparm_article=KB0010001','_blank');

Does not work because selecting the Client option for a UI Action disables the button   (in Custom Scoped Application - Jakarta)

GlideDialogWindow('https://dev10457.service-now.com/kb_view.do?sysparm_article=KB0010001', true);

has not worked either.

I have a UI policy that opens the KA in a new window:

function onCondition() {

g_navigation.openPopup('https://dev10457.service-now.com/kb_view.do?sysparm_article=KB0010001', true);

}

but cannot figure out how to make a UI policy recognize a Button click (UI action).

Also I have tried populating the value of a field within the UI Action but

g_form.setValue('u_table', field); has not worked (in Custom Scoped Application - Jakarta)

Any ideas opening a URL in new browser window using UI Action in Custom Scoped Application - Jakarta???

Thanks for your time,

Lon

1 ACCEPTED SOLUTION

Thats great Lon. Can you please mark this thread answered so that it could help someone in future?



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

9 REPLIES 9

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Lon,



In the standard forms UI (eg client scripts, client ui actions) - by default, we block access to the DOM and certain top-level globals (window, document, $ / jquery). You can enable an application-specific property to gain access to the DOM.


You can enable an application-specific property to gain access to the DOM. This provides a good tradeoff by setting a default with best practice guard rails, and allowing a developer to take explicit action to opt out of the best practice.


To opt out of the best practice create the following property in your scope and set it to false. glide.script.block.client.globals



On another note, you mentioned that "Does not work because selecting the Client option for a UI Action disables the button   (in Custom Scoped Application - Jakarta)". Did you mean you are not able to select client operation in UI action for scoped application?


SanjivMeher
Kilo Patron
Kilo Patron

Is it not working on Service Portal?



You can write your own custom UI actions on Service Portal and get it working.



Please mark this response as correct or helpful if it assisted you with your question.

I have glide.script.block.client.globals set to false in both Global & Custom scoped application.


If Client is selected the UI Action (button) stops working regardless of the code in the script field (Server or Client side scripts)


The button has a hover effect but does nothing onClick


ui_action_client.png


option.png


I am using it on a Service Portal widget Client Controller and it just work fine.



var link = 'kb_view.do?sys_kb_id='+$scope.data.kbsysid;


window.open(link,'popup','toolbar=0,menubar=0,width=600,height=600');



Please mark this response as correct or helpful if it assisted you with your question.