Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to show the instance url on message key (sys_ui_message table ) in servicenow

Rajveer
Tera Expert

Hello Expert


I have to show "login here" in message ui page .How to give hyperlink on " login here" on message page(sys_ui_message) in ServiceNow 

2 REPLIES 2

Community Alums
Not applicable

Hi @Rajveer ,

You can use parematers in the message which are set in the text as {0], {1}, etc.

This means that you can parse a url or name as parameter to show this dynamically.

Here's is an example:

 

function onSubmit() {
   
   var shortDescrp = g_form.getValue("short_description");
   var descrp = g_form.getValue("description");
   var uri = '<a href="./esc?id=sc_cat_item&sys_id=---sys_idhere---">Catalog item name</a>';

   if(shortDescrp == "" || descrp == "")
   {
	g_form.addErrorMessage(getMessage('Error Message iSource Support',uri));
	return false;
   }
   
}

 

Your message record would then look like:

 

You can create a ticket by going to {0}

 

Reference : How to insert the link for message 

Community Alums
Not applicable

Hi @Rajveer ,

You can use below script to show login message as url 

var uri =  '<a href="https://YourInstance.service-now.com/">Login Here</a>'; 
	g_form.addInfoMessage(getMessage('Your Message') + ' ' + uri + ' ');

Result 

SarthakKashya2_0-1714475861342.png

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak