- 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 09:10 AM
Hi Ankur,
I am redirected to the page cannot be found.
- 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-28-2022 05:39 AM
Hi
Yes it works and it is now redirecting to the list of records for the incident task. Is it possible to redirect to only the record in the incident task that is in the related list instead of all the records?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 05:53 AM
Hi,
Glad to know that it worked.
Please mark my response as correct and helpful to close the thread.
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-28-2022 05:54 AM
Hi,
you are now taking user to the incident tasks which are associated to the incident present on form i.e. incident tasks linked to the current incident
I didn't get what you meant by this
redirect to only the record in the incident task that is in the related list instead of all the records
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader