How to add hyper link to info message

Alon Grod
Tera Expert

Hi,

Im trying to add info Message using onLoad client script. this is the desired message:

Hi, a change has been made CHG004007, please be aware.

When the user click on the change number he needs to be redirected to the change.

How can I achieve that?

1 ACCEPTED SOLUTION

You'll need the Script Include to send the Change Number and the sys_id.  You can concatenate the message like this:

var msg = "Hi, a change has been made <a href='https://dev11.service-now.com/now/nav/ui/classic/params/target/change_request.do%3Fsys_id%3D" + returneddata.sysid + " ' target='_blank'><strong>" + returneddata.number + "</strong>, please be aware</a>."
g_form.addInfoMessage(msg);

This post guides you through returning more than one value, if you haven't done this yet.

https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2... 

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

Hi Alon,

For this static message, you would use something like this:

g_form.addInfoMessage("Hi, a change has been made <a href='https://dev11.service-now.com/now/nav/ui/classic/params/target/change_request.do%3Fsys_id%3D9acdf552db252200a6a2b31be0b8f507' target='_blank'><strong>CHG004007</strong>, please be aware</a>.");

replacing dev11 with your instance name, and the sys_id of your intended change request following sys_id%3D

@Brad Bowman  hi thanks for the response. how can I make 'CHG004007' to be dynamic. basically im Im calling a script include that sending back the Change number. how can I insert the change number dynmically into the href link

You'll need the Script Include to send the Change Number and the sys_id.  You can concatenate the message like this:

var msg = "Hi, a change has been made <a href='https://dev11.service-now.com/now/nav/ui/classic/params/target/change_request.do%3Fsys_id%3D" + returneddata.sysid + " ' target='_blank'><strong>" + returneddata.number + "</strong>, please be aware</a>."
g_form.addInfoMessage(msg);

This post guides you through returning more than one value, if you haven't done this yet.

https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2...