How to create UI action link to redirect to incident which was created

AnandKumar1
Tera Expert

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.

1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron
Kilo Patron

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);

 

View solution in original post

7 REPLIES 7

Thanks Sachin. Its working now.

can you please mark answer as correct?

 

Regards,

Sachin

Jaspal Singh
Mega Patron
Mega Patron

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