The CreatorCon Call for Content is officially open! Get started here.

Shows all the values in the reference field when advance reference qualifier is not invoked

Imran1
Giga Guru

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

 

 

 

2 ACCEPTED SOLUTIONS

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

 

View solution in original post

@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.

View solution in original post

5 REPLIES 5

Thank You Sandeep