Add link in info message

alexm3
Kilo Expert

Hello,

I have the following client script:

--------------------

function onChange(control, oldValue, newValue, isLoading) {

  if (newValue == '')

  return;

  if (newValue == 'ABC')

  g_form.addInfoMessage('Please see knowledge article KB0011111');

  else

  g_form.clearMessages();

----------------------

This script will add an info message at the top of the page when value is ABC. My question is, can I make the KB number as a hyperlink so that people could click on the KB number and be redirected to the its page?

Thanks,

Alex

1 ACCEPTED SOLUTION

Inactive_Us1137
Mega Expert

Hi Alexandru, Michal



It is possible to add the link in the addinfomessage. Please find the sample script below.



function onLoad() {


    g_form.addInfoMessage("Please <a href = '/incident_list.do'>Click</a>");


   


}


Replace the above url with the one your looking to add.



Thanks


Abhishek


PS - Please mark this Helpful, Like, or Correct Answer if relevant.


View solution in original post

10 REPLIES 10

Inactive_Us1137
Mega Expert

Hi Alexandru, Michal



It is possible to add the link in the addinfomessage. Please find the sample script below.



function onLoad() {


    g_form.addInfoMessage("Please <a href = '/incident_list.do'>Click</a>");


   


}


Replace the above url with the one your looking to add.



Thanks


Abhishek


PS - Please mark this Helpful, Like, or Correct Answer if relevant.


Thank you very much Abhishek! It works !


Hi Abhishek,



how do I add external link(link to Jive document) in addinfomessage?


Hi Ashwini,



It is similar to any other link you can add.



example:


instead of google.com you can add link to your jive


g_form.addInfoMessage("Please <a href = 'http://www.google.com' target='_blank'>Click</a>");




Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

This worked Ankur, Thanks