Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

What does' sys_idIN' mean when used in a query? Eg : 'active=true^sys_idIN' + function( )

Rama Chandra D
Kilo Guru

I'm trying to figure out a script which has the syntax mentioned in the question, that is 'active=true^sys_idIN' + function( ). Can someone explain to me what does sys_idIN do here? Does it simply include the sys_id passes to the query as one of the a condition?

1 ACCEPTED SOLUTION

Use this



javascript: 'typeLIKExxxx^active=true^sys_idIN' + gs.getUser().getUserByID(user id).getMyGroups().toArray().join() + '^EQ'


View solution in original post

20 REPLIES 20

This is for a reference qualifier and it is run on a group table.


scottcornthwait
Kilo Expert

Where i would go with this is to use one function created in a script include to return the whole ref qualifier, and in the ref qualifier, just call the function name.



The code of the script include would be similar to this:



function getMyRequestGroups(){


  var refQual = 'active=true';


  var gpm = new GlideRecord('sys_user_grmember');


  var qry = 'group.typeLIKE#INSERT SYS_I OF REQUEST TYPED#^user=' + gs.getUserID();


  var sysIDs = '';


  gpm.addEncodedQuery(qry);


  while (gpm.next()){


  if (sysIDs == ''){


  sysIDs = '^sys_idIN' + gpm.sys_id;


  }


  else{


  sysIDs = sysIDs + ',' + gpm.sys_id;


  }



  }


  refQual = refQual + sysIDs;



  return refQual;


}


Thank you. I'll just go through the script you have provided and I'll give you a feedback


Can you please explain, why?


You do not need script include for this. Use my code, you should be good