Add an URL to Alert or through addInfoMessage

prabhmeet
Giga Expert

Hi ,

I have to put some text and a URL link in an Alert box which is displayed on On Submit of a Catalog item.

I know that Alert box can only contain String not an URL. But URL can be displayed with addInfoMessage. 

Now the issue is that  the script works on Submit and so the message is displayed on Submit but in a second the page gets changed. Is there any way to Stop the page from changing or adding URL in Alert Box?

 

Thanks.

3 REPLIES 3

VigneshMC
Mega Sage

Alert does not support URL's, try using sweet alerts as a workaround.

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

Rahul RJ
Giga Sage
Giga Sage

Hi,

You can add URL in addInfoMessage .

var url='URL to open';
	
var urlString = '<a class="web" target="_blank" href="' + url + '">' + Text to display + '</a>';
	
g_form.addInfoMessage(urlString);
	

 

Thanks,

RJ

HI RJ, I know that my question is that it is written on an On SUbmit script script, so message is displayed only for a second until page moves to next page. Is there a way to keep it on the same page for a few seconds?