- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 07:56 AM
Hi Team,
I have a requirement to provide a link "open incident" in my custom table which should redirect to the incident which was already created.
I have stored the incident number in "u_incident" in my custom table.
I tried the below script in ui action. I have doubt in addquery.
condition: current.state =="inprogress"
Script:
var gr = new GlideRecord("incident");
gr.addQuery('u_incident', current.sys_id); // i have doubt in this query.
gr.query();
if(gr.next()){
var sysId = gr.sys_id;
var url = "incident.do?sys_id=" + sysId;
gs.print(url);
action.setRedirectURL(url);
}
Please help me.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 08:03 AM
use below code
var gr = new GlideRecord("incident");
gr.addQuery('sys_id', current.u_incident); // i have doubt in this query.
gr.query();
if(gr.next()){
var sysId = gr.sys_id;
var url = "incident.do?sys_id=" + sysId;
gs.print(url);
action.setRedirectURL(url);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 08:19 AM
Thanks Sachin. Its working now.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 08:35 AM
can you please mark answer as correct?
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 08:03 AM
Use below.
gr.addQuery('number', current.u_incident); // if u_incident is a string field that stores number
gr.addQuery('sys_id', current.u_incident); // if u_incident is a reference to incident table