- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 07:17 AM
When user opens the existing incident and there is the parent incident of the same incident then there should be a message at the top “this incident is child xxxx incident” and when user click on parent incident number, it should open the same incident in new tab.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 07:47 AM
@SandeepKSingh You should be able to configure a display business rule to achieve this.
Query: Parent Incident is NOT EMPTY
Script: gs.addInfoMessage("This incident is a child incident of <INCxxxxxx>"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:15 AM
Hi @SandeepKSingh Try below onLoad client script
var parentIncidentId = g_form.getValue('parent');
if (parentIncidentId) {
var message = 'This incident is a child incident of ' + parentIncidentId + 'incident.';
g_form.addInfoMessage(message);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:02 PM - edited 08-24-2024 06:20 PM
Hello,
Please use onLoad CS
var incident = g_form.getValue('parent')
if (incident) {
var message = "This incident is a child of incident <a href='incident.do?sys_id=" + parentIncident + "' target='_blank'>" + parentIncident.getDisplayValue() + "</a>";
g_form.addInfoMessage(message);
}
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 07:47 AM
@SandeepKSingh You should be able to configure a display business rule to achieve this.
Query: Parent Incident is NOT EMPTY
Script: gs.addInfoMessage("This incident is a child incident of <INCxxxxxx>"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:15 AM
Hi @SandeepKSingh Try below onLoad client script
var parentIncidentId = g_form.getValue('parent');
if (parentIncidentId) {
var message = 'This incident is a child incident of ' + parentIncidentId + 'incident.';
g_form.addInfoMessage(message);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:02 PM - edited 08-24-2024 06:20 PM
Hello,
Please use onLoad CS
var incident = g_form.getValue('parent')
if (incident) {
var message = "This incident is a child of incident <a href='incident.do?sys_id=" + parentIncident + "' target='_blank'>" + parentIncident.getDisplayValue() + "</a>";
g_form.addInfoMessage(message);
}
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2024 01:38 PM - edited 08-26-2024 08:18 AM
The above doesn't work for me. 'g_form.getRecord()' is not documented. the client script will need to use GlideAjax to get the number value of the parent_incident field.
[edit] I see the above was edited to remove the g_form.getRecord() and that there is now 'parentIncident' on the line that builds the message to display. However 'parentIncident' is never initialized. Folks should test solutions before posting.
[Edit 2]
The OP has changed here. The request here has little value as the Incident form has a related list of "Related Records", where the 'parent_incident' is shown with an icon to open that record.