Display infomessage with link to the related list records

Ramel
Mega Guru

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 

}

1 ACCEPTED SOLUTION

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

19 REPLIES 19

Hi Ankur,

I am redirected to the page cannot be found.

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

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,

Hi,

Glad to know that it worked.

Please mark my response as correct and helpful to close the thread.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader