- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 11:31 AM
Hi Experts,
I need help in one logic where in a variable I am getting multiple people. Now what I want to do is I want to remove people who will be absent(their data is present in one table) from that available variable.
How can this be achieved?
Solved! Go to Solution.
- Labels:
-
Architect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 11:12 PM
Hi @SnowUserDev ,
Try the below code n see if it works or not
var finalusers = '';
var a = user1,user2,user3;
a = a.split(',');
for(var i=0;i<a.length;i++){
var gr = new GlideRecord ('table_name');
gr.addQuery('user_field_name',a[i]);
gr.addQuery('active',true);
gr.query();
if(gr.next()){
//do nothing
}else{
finalusers.push(a[i]);
}
}
gs.info(finalusers);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 11:35 PM
@Danish Bhairag2 perfect it worked