Reference qualifier not calling script include

Brijmohan
Tera Contributor

Hi, I have a requirement in catalog item. I have two variables "Search for people" and "Type keyword for search" based on this I want users should be display in reference fields called "search results" but it is showing all users.

I am using script include and advance reference qualifier but it is not working even no logs are showing in logs table.
Not sure what I am doing wrong.

getFilter: function(type, keyword, selectedUsers) {

        gs.info("GEVN_ONEIDM: type = " + type);
        gs.info("GEVN_ONEIDM: keyword = " + keyword);
        gs.info("GEVN_ONEIDM: selectedUsers = " + selectedUsers);

        if (!keyword || keyword=='' || keyword == 'undefined') {
            gs.info("GEVN_ONEIDM: No keyword entered");
            return 'sys_id=NULL';
        }

        var query = '';

        // SSO search
        if (type == 'sso') {
            query = 'user_nameLIKE' + keyword;
        }

        // First name / Last name search
        if (type == 'first_name_last_name') {
            query = 'first_nameLIKE' + keyword + '^ORlast_nameLIKE' + keyword;
        }

        // Email search
        if (type == 'email_address') {
            query = 'emailLIKE' + keyword;
        }

        // Manager search
        if (type == 'directly_reports_to') {

            gs.info("GEVN_ONEIDM: Searching manager using SSO");

            var mgr = new GlideRecord('sys_user');
            mgr.addQuery('user_name', keyword);
            mgr.setLimit(1);
            mgr.query();

            if (mgr.next()) {
                gs.info("GEVN_ONEIDM: Manager found = " + mgr.name);
                query = 'manager=' + mgr.sys_id;
            } else {
                gs.info("GEVN_ONEIDM: Manager NOT found");
                return 'sys_idISEMPTY';
            }
        }

        // Remove already selected users
        if (selectedUsers) {
            gs.info("GEVN_ONEIDM: Removing selected users");
            query += '^sys_idNOT IN' + selectedUsers;
        }

		if(!query){
			return 'sys_idISEMPTY';
		}

        gs.info("GEVN_ONEIDM FINAL QUERY: " + query);

        return query;
    },

 

 Reference qualifier in search result variable: 

javascript​: new global.GEVN_ONEIDM().getFilter(current.variables.v_search_for_people,current.variables.v_type_keyword_for_search,current.variables.v_people);

 

Screenshot 2026-03-12 003059.png
 
Regards,
Brij
13 REPLIES 13

Zach Koch
Giga Sage

On your Script include, is the Client Callable checkbox checked? Since this is being used as a reference qualifier, you'll need that checked.

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Hi @Zach Koch , yes, it is checked.

Ankur Bawiskar
Tera Patron

@Brijmohan 

catalog item, variable and script include all in same scope?

share the config screenshots here

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar , PFA screeenshots.Choice.pngKeyword search.pngSearch result1.pngSearch results.pngCatalog item.pngScript include.png