dot-walking in a JOIN encoded query for an Advanced Reference Field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2023 12:50 PM - edited 03-22-2023 12:54 PM
Hi all,
We need to enhance the performance of a "sys_user" table reference variable. We need to show all users that belongs to a group of a certain group type.
Right now we are using this:
javascript: 'sys_idIN' + new Utils().UsersGroupType('0f5beebb975f5d903851f007f053af41');
This has a slow performance because there are 10000+ users,
We can't also use Lookup Select Box because it exceeds the limit of results.
We are dealing with the JOIN in an encoded query to put it afterwards on the Reference Qualifier
This works on a Background Script
var gr = new GlideRecord('sys_user');
gr.addActiveQuery();
var grjoin = gr.addJoinQuery('sys_user_grmember','sys_id','user');
grjoin.addCondition('group.type','CONTAINS','0f5beebb975f5d903851f007f053af41');
gr.query();
This works on an Encoded Query (with no dot-walking)
var gr = new GlideRecord('sys_user');
gr.addActiveQuery();
gr.addEncodedQuery('JOINsys_user.sys_id=sys_user_grmember.user!groupCONTAINS0f5beebb975f5d903851f007f053af41');
gr.query();
But dot-walking is not working on an encoded query
var gr = new GlideRecord('sys_user');
gr.addActiveQuery();
gr.addEncodedQuery('JOINsys_user.sys_id=sys_user_grmember.user!group.typeCONTAINS0f5beebb975f5d903851f007f053af41');
gr.query();
Has anyone dealed with this problem? Maybe ther is other solutions?