- 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-28-2022 06:01 AM
Hi Ankur,
There is an incident task record added in the related list. So if there is one incident task added in the related list, I want to redirect the user to the specific incident task form when they click the link, easy for them to update the record. Instead of being redirected to the whole list of records and still need to filter and search for the incident task. I know they can just click on the incident task record but they also want to have added functionality that it can be done when they click the link in the infomessage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 06:13 AM
I believe I have answered your original question.
Would you mind marking 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 06:23 AM
Hi,
but what if there are more than 1 incident tasks in related list?
which incident task you wish them to be taken?
any random one?
So I would suggest to show them list and then they can update whichever they want.
If you still want to pick random one then you will have to query incident_task table and get 1 record and then show the link
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 06:25 AM
Hi Ankur,
The first incident task always if there are multiple tasks. But if only one incident task then redirect to that form for them to update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 06:31 AM
Hi,
then you need to script it in client side using GlideRecord
You can use GlideAjax as well since GlideRecord is not recommended in client side.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader