Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Issue with advanced reference qualifier on the catalog item variable

PrasadK43791691
Giga Contributor

Hello Team, 


I have a catalog item having a check box variable called inactive users. If the variable is true, only inactive users should be available to select on the requested for variable. otherwise active users should be available to select on the requested for variable. 

I have tried advanced reference qualifier with script include but having a confusion, can we validate the catalog item variable value on script include or advanced ref qual script? 

 

Requesting to suggest a best approach for this requirement.

Thanks!

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@PrasadK43791691 

OOTB only active users are shown in reference variable

I assume your reference variable is referring to sys_user

Use this in advanced ref qualifier

javascript: var query = 'active=true'; if(current.variables.checkboxVariable.toString() == 'true') query = 'active=false'; query;

But remember you will require this workaround to show inactive users in your reference variable

How to make inactive users available for selection in reference fields/variables 

💡 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

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@PrasadK43791691 

OOTB only active users are shown in reference variable

I assume your reference variable is referring to sys_user

Use this in advanced ref qualifier

javascript: var query = 'active=true'; if(current.variables.checkboxVariable.toString() == 'true') query = 'active=false'; query;

But remember you will require this workaround to show inactive users in your reference variable

How to make inactive users available for selection in reference fields/variables 

💡 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

pr8172510
Kilo Sage

Hi @PrasadK43791691 ,

I implemented the approach using an Advanced Reference Qualifier along with the ref_qual_elements variable attribute, without using a Script Include.

Now the Requested For reference dynamically filters users based on the Inactive Users checkbox

  • Checkbox unchecked → Active users are displayed.
  • Checkbox checked → Inactive users are displayed.

    pr8172510_0-1790085419302.pngpr8172510_1-1790085433011.png

     

    pr8172510_2-1790085441050.pngpr8172510_3-1790085454275.pngpr8172510_4-1790085462460.png

     

PrasadK43791691
Giga Contributor

Hi @pr8172510 , 

 

Thanks for the response. The screenshots that you have attached is not clear. Could you please upload Adv req qual condition?

 

Thank you!