servicenow
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 11:19 PM
If the current incident is a child incident, add a info message with a clickable parent incident number.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 11:21 PM
function onLoad() {
//Type appropriate comment here, and begin script below
var parent = g_form.getReference('parent_incident', parentFunc);
function parentFunc(parent) {
var p = g_form.getValue('parent_incident');
if (p != "") {
g_form.addInfoMessage('This is a child incident of ' + '<ahref = \'https://dev64478.service-now.com/nav_to.do?uri = incident.do ? sys_id = ' + parent.sys_id + '\'target = \'_blank\'>' + parent.number + '</a>');
}
}
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 11:40 PM
Hi use onload client script
function onLoad() {
if (g_form.getValue('parent_incident') != '') {
var parentIncidentNumber = g_form.getValue('parent_incident');
var link = '<a href="' + parentIncidentNumber + '">' + parentIncidentNumber + '</a>';
var message = 'This incident is related to parent incident: ' + link;
g_form.addInfoMessage(message);
}
check below screenshot its working i try on my pdi
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 11:41 PM - edited 02-27-2024 11:43 PM
Hi @venkatamahesh
Just write a display business rule where the condition should be parent incident is not empty and in the script section add the below-mentioned script.
Conditon
Script
var link = '<a href="incident.do?sys_id='+current.parent_incident+'"> '+current.parent_incident.number+' </a>';
var message = gs.getMessage('Parent incident') + ' ' + link + ' ';
gs.addInfoMessage(message);
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks!