- 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:12 AM
can your try this
var link = '<a href="incident_task_list.do?sysparm_query=incident=">'+g_form.getUniqueValue()+'List Link</a>';
var message = gs.getMessage('Incident tasks') + ' ' + link + ' ';
g_form.addInfoMessage(message);
mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 12:36 PM
if yes please mark the answer correct and close the thread ,if not let me know how i can help with the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 11:12 PM
Hi Mohith,
It is still not working, in var message you are still using gs.getMessage which is not working in client side. I am trying to use this format
g_form.addInfoMessage("Please <a href = '/incident_list.do'>Click</a>");
Just in one go, no more var declaration. I tried Ankur's suggestion but it redirects to not found.
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>");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 11:21 PM
Hi,
I shared the update code below check that
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:33 AM
Hi,
like this in your client script
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