- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 08:15 AM
Hi Community,
I have a requirement to display an infomessage that contains the link that will direct to the list of records in the related list. Like for example I have an incident, then I have a related list called Incident Tasks, the infomessage is displayed in the incident form but how can I write in script format so that the link in the infomessage will direct the user to the list of records or to the form record in the incident task related list?
function onLoad() {
g_form.addInfoMessage("Please <a href = '/incident_list.do'>Click</a>"); // the bold part, what should I replace it so i can be redirected to the list of incident tasks that is added
}
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 11:20 PM
Hi,
please update as this and it should work fine
you should use ? I showed in bold below
function onLoad() {
g_form.addInfoMessage("Please <a href = '/incident_task_list.do?sysparm_query=parent=" + g_form.getUniqueValue() + "^ORincident=" + g_form.getUniqueValue() + " target='_blank'>Click</a>");
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 08:24 AM
Hello
you can try this
You can use the below example to do this .Just replace the incident_list with your incident task table name
var link = '<a href="incident_task_list.do?sysparm_query=incident%3D">'+current.sys_id+'List Link</a>';
var message = gs.getMessage('Incident tasks') + ' ' + link + ' ';
gs.addInfoMessage(message);
please mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 08:29 AM
Hi Mohith,
I am using onload client script but this one is using current.sys_id. Can it be done on client script alone or need to use BR?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 08:31 AM
hello
var link = '<a href="incident_task_list.do?sysparm_query=incident%3D">'+g_form.getUniqueValue()+'List Link</a>';
var message = gs.getMessage('Incident tasks') + ' ' + link + ' ';
g_form.addInfoMessage(message);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 09:06 AM
it is returning the whole list of records, not just the record in the related list.