Reference Qualifere is not working from the catalog variable

mihirlimje867
Tera Guru

Hello Community,

I'm facing an issue with the reference qualifier of the catalog variable.

Requirement- 

For that, we have two variables: - 
1. Former Associate's Name [associate_name] type - Reference (sys_user)

2. Manager's Name [contact_name] type - Reference (sys_user)

 

I want to select only those users in the Former Associate's Name variable whose manager is selected from the Manager's Name variable.

 

mihirlimje867_0-1746445742210.png

 

 

Development:
We have called the script include from the reference qualifier of the Former Associate's Name catalog variable.

 javascript:new global.getManagerDirectReport().getManagers(current.variables.contact_name);

 

mihirlimje867_1-1746446321630.png

 

Script Inlcude: 
Note- We don't have any ACL on the Script inlcude.

var getManagerDirectReport = Class.create();
getManagerDirectReport.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    getManagers: function(manager) {
        var mgr_sys_ids = [];
        var userAgg = new GlideRecord('sys_user');
        userAgg.addQuery('manager', manager); // Get users who have a manager
        userAgg.query();
        while (userAgg.next()) {
            mgr_sys_ids.push(userAgg.getUniqueValue()); // Get the manager sys_id
        }
        return 'sys_idIN' + mgr_sys_ids.join(',');
    },
    type: 'getManagerDirectReport'
});

 

mihirlimje867_2-1746446523304.png

This is working as expected for some users, which means when I select manager so only those user shows in Former Associate's Name, whoever the manager is selected.

But when I select a different manager so for the Former Associate's Name variable shows the searching only.
Previously, I thought this was a role issue with the selected manager but when I selected a different manager with the same user role so this was working fine for the selected manager.


Could anyone please help me to resolve this issue? Why is this functionality working fine for some user's but not for some user's?




 

1 REPLY 1

Chaitanya naram
Kilo Sage

Hi @mihirlimje867 ,

Make the former associate field non mandatory and hidden by default. And whenever a value selected in the manager field, make this field mandatory and visible. 

Then it works.

Thanks & Regards | Chiranjeevi Chaitanya Naram
Kindly mark the answer Correct and Helpful if it helps to resolve your issue.