- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2022 11:45 AM
Odd request - I need to add a "Click here" option in a client script message to replace a UI Action.
I'm been trying to mess around with it and I know its possible, because I've seen it before.
Script sample
if (distance < 0) {
clearInterval(x);
answer = 'This incident is permanently closed!';
g_form.setValue('u_timer',answer);
gel('incident.u_timer').style.backgroundColor = "tomato";
g_form.setReadOnly('u_timer', true);
return ;
} else {
answer = 'You have '+days+'d '+hours+'h '+minutes+'m '+seconds+'s left to Reopen this Incident. Click <a href="https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=eaf12dc51bdfc910c3c96535604bcbeb"> here</a>. to reopen this incident';
g_form.setValue('u_timer',answer);
gel('incident.u_timer').style.backgroundColor = "gold";
g_form.setReadOnly('u_timer', true);
return ;
I want it to do something like this with a clickable link
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 03:19 PM
Hi,
Ah, ok, perhaps.
You're definitely not able to create a clickable URL within a string field.
You could try and use a URL field that it's link goes to the incident, but the verbiage says all that (like in your screenshot), but then the whole thing is clickable and may look a bit wonky.
You're better off using a form info message, for example, that is presented at the top of the form that can say all of that and then contain a clickable piece of it within.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 03:19 PM
Hi,
Ah, ok, perhaps.
You're definitely not able to create a clickable URL within a string field.
You could try and use a URL field that it's link goes to the incident, but the verbiage says all that (like in your screenshot), but then the whole thing is clickable and may look a bit wonky.
You're better off using a form info message, for example, that is presented at the top of the form that can say all of that and then contain a clickable piece of it within.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2022 11:49 AM
Hey,
Try doing something like this in your client script:
var link = '<a href="incident_list.do">List Link</a>';
var message = gs.getMessage('Incident Resolved') + ' ' + link + ' ';
gs.addInfoMessage(message);
Ref link
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0691931
Aman Kumar