can we call url in script action virtual agent?

GN
Tera Expert

Hi 

I am trying to call url in virtual agent script action using window.open('url',"_blank').

but it is giving an error. is there any other option to open url directly.

2 REPLIES 2

Community Alums
Not applicable

Hi GN,

This thread should help you :

https://community.servicenow.com/community?id=community_question&sys_id=59efa6a8dba4145023f4a345ca96...

Mark my answer correct & Helpful, if Applicable.

Thanks,
Sandeep

Chris D
Mega Sage
Mega Sage

window.open is client-side Javascript - VA scripts are all run server-side so I can see that that wouldn't work.

I'm not sure it's possible to automatically open a URL from VA but your best bets to check would be a) look on ServiceNow's API documentation: Server Global API | ServiceNow Developers and/or b) search the Developer Community (not VA-specific) to see if there's an undocumented API that can open a URL.

The simplest - and arguably best* - solution is to just provide the hyperlink to the URL in a text/link response for the user.
*I say arguably best because, from a UX perspective, it's not a good experience to suddenly have a different window appear from no action of your own. At this point, it acts almost like the dreaded Web 1.0 Pop-up Ad.