IN operator in filter

User150433
Tera Guru

How is it possible to get the IN operator in filter for other tables the way it is present on choices table. Screenshot attached.
Also is it possible to query databse using IN operator the way it is possible in normal SQL.

Select * from employee where department in ('finance','IT','Sales');


Amit

2 REPLIES 2

Jay_Ford
Kilo Guru

Amit,

If you are doing this in a GlideRecord query you can do it like this.



gr.addQuery('sys_idIN0331ddb40a0a3c0e40c83e9f7520f860,032ebb5a0a0a3c0e2e2204a495526dce');


or like this



gr.addQuery('sys_id','IN','0331ddb40a0a3c0e40c83e9f7520f860,032ebb5a0a0a3c0e2e2204a495526dce');


Hope this helps


Hi Jay,



I am using 'IN' operator in glideRecord query and it's not working either of the way. Can you pls suggested what wrong I am doing here.



(function executeRule(current, previous /*null when async*/){



  var gr = new GlideRecord('sys_user_role');


  gr.addQuery('name','IN','current.u_role,current.u_end_user_role');


  gr.query();


  while(gr.next()){


  gs.log("2 --Records in role table: " + gr.getRowCount());


  //gr.deleteRecord();


  }


})(current, previous);