How to show the instance url on message key (sys_ui_message table ) in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 02:03 AM - edited 04-30-2024 07:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 02:43 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 04:18 AM
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
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak