The CreatorCon Call for Content is officially open! Get started here.

How to get sys_id of a record obtained from gliderecord query.

Karan31
Tera Contributor

Hi , I am creating a UI action to redirect to a record that is queried from another table.

 

1.var itemID = current.sys_id;  >>>>  sys_id of record in Catalog Item table
2.var ts = GlideRecord('sys_atf_test_suite');  >>>> gliderecord on suite table to find a record which has sys_id of catalog item 
3.ts.addQuery('u_suite_id',itemID); >>> quering the table for item sys id in field Suite id
4.ts.query();
5.while(ts.next()){
6.action.setRedirectURL('sys_atf_test_suite.do?sys_id=' + current.sysid); }  >>> as i want to redirect to that record found from quering.

 

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

updated code

 

var itemID = current.sys_id;

var ts = new GlideRecord('sys_atf_test_suite'); 

ts.get('u_suite_id',itemID);

action.setRedirectURL('sys_atf_test_suite.do?sys_id=' + ts.sys_id); 

View solution in original post

8 REPLIES 8

u_suite_id : this field is correct ? you created custom column on sys_atf_test_suite table ?

Karan31
Tera Contributor

No Worries, Harshwardhan it worked.

 

Thanks a ton for this.

glad i helped. kindly mark my answer as correct and close this thread. 

HI harshvardhan need a little more help. i need a condition as well on ui action that the button will only reflect if there is already an relation established for the item in suite table..

can this be done ?