
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 08:41 AM
Hi All,
I am unsure if I can come across clearly about my situation.
Anyway I will give it a try.
I have an advanced reference qualifier which is calling a script include to get the users from sys_user table who belong to the groups.
advance reference qual value is below.
javascript:'active=true^'+'sys_idIN'+ new groups_users().get_IDs(current.supplier.group)+ new groups_users().get_IDs(current.supplier.client_group)+ new groups_users().get_IDs(current.supplier.gsi_group)
When I have a new record and no value in current.supplier (field) I get all the values in the reference field from sys_user table.
Not sure what I have to do within my qualifier script above.
I tried calling the below function via script include but it did not worked
example
var GroupReferenceQualifier = Class.create();
GroupReferenceQualifier.prototype = {
initialize: function() {
},
getGroupQuery: function(current) {
var ids = new groups_users().get_IDs(current.supplier.group) +
new groups_users().get_IDs(current.supplier.client_group) +
new groups_users().get_IDs(current.supplier.gsi_group);
if (ids) {
return 'active=true^sys_idIN' + ids;
} else {
return 'sys_id=NULL';
}
},
type: 'GroupReferenceQualifier'
};
used this new qualifier
javascript:new GroupReferenceQualifier().getGroupQuery(current);
but this too did not worked.
I am not sure where I am going wrong my ask is simple when I don't have any value in the field "Supplier" & If it is a new record then I should not see all the names from sys_user table in the reference field.
Thank You for your assistance in advance.
Regards,
Imran
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 10:24 PM
Included one more condition that resolved this issue I was seeing
var GroupReferenceQualifier = Class.create();
GroupReferenceQualifier.prototype = {
initialize: function() {},
getGroupQuery: function(current) {
if(current.supplier){
var ids = new groups_users().get_IDs(current.supplier.group) +
new groups_users().get_IDs(current.supplier.client_group) +
new groups_users().get_IDs(current.supplier.gsi_group);
if (ids) {
return 'active=true^sys_idIN' + ids;
}
return 'sys_idISEMPTY';
}
else {
return 'sys_idISEMPTY';
}
},
type: 'GroupReferenceQualifier'
};
Thank You appreciate your help
Regards,
Imran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 11:39 PM
@Imran1 I didn't focus to much on the if statement rather my intent was to suggest you
sys_idISEMPTY
Which ultimately worked for you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 09:01 AM
@Imran1 Please update the script include as follows and see if it works.
var GroupReferenceQualifier = Class.create();
GroupReferenceQualifier.prototype = {
initialize: function() {
},
getGroupQuery: function(current) {
var ids = new groups_users().get_IDs(current.supplier.group) +
new groups_users().get_IDs(current.supplier.client_group) +
new groups_users().get_IDs(current.supplier.gsi_group);
if (ids) {
return 'active=true^sys_idIN' + ids;
} else {
return 'sys_idISEMPTY';
}
},
type: 'GroupReferenceQualifier'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 09:11 PM
Hi Sandeep,
It is not working. Do you think I have to do something with this script include that is being called?
var groups_users = Class.create();
groups_users.prototype = {
initialize: function() {},
get_IDs: function(groups_list) {
var _grMem = [];
var userID;
var _gpQuery = "group.parentIN" + groups_list + "^ORgroup.sys_idIN" + groups_list;
var grGM = new GlideRecord("sys_user_grmember");
grGM.addEncodedQuery(_gpQuery);
grGM.query();
while (grGM.next()) {
userID += grGM.user + ',';
}
return 'sys_idIN' + userID.toString();
},
type: 'groups_users'
};
Regards,
Imran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 10:24 PM
Included one more condition that resolved this issue I was seeing
var GroupReferenceQualifier = Class.create();
GroupReferenceQualifier.prototype = {
initialize: function() {},
getGroupQuery: function(current) {
if(current.supplier){
var ids = new groups_users().get_IDs(current.supplier.group) +
new groups_users().get_IDs(current.supplier.client_group) +
new groups_users().get_IDs(current.supplier.gsi_group);
if (ids) {
return 'active=true^sys_idIN' + ids;
}
return 'sys_idISEMPTY';
}
else {
return 'sys_idISEMPTY';
}
},
type: 'GroupReferenceQualifier'
};
Thank You appreciate your help
Regards,
Imran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 11:39 PM
@Imran1 I didn't focus to much on the if statement rather my intent was to suggest you
sys_idISEMPTY
Which ultimately worked for you.