How to add a filter to reference user field based on another reference user field?

Luiz Lucena
Mega Sage

Hello friends, 

We have a form using a variable set shared across multiple catalog items, it contains a field called Affected User (u_requested_by) which references the user table and is meant to be the person receiving what is being requested.
In this particular form, we also have a second field referencing the user table (u_priv_account), but in this case, the user to be put in this field is the elevated account for the Affected User, because we cannot have regular accounts having privileged accesses. 
Screenshot 2024-12-19 163905.png

The current filter in the (u_priv_account) is set as simple:
AD Account Status IS True AND Source CONTAINS OU=Privil

Even though this works as expected, sometimes, the person filling the form specifies another person privileged account while leaving their own name in the Affected User field, affecting notification, reporting, approvals, etc.

In our user table, we have a custom field that correlates the privileged account with the regular account, like below:
Screenshot 2024-12-19 171314.png

How can filter in the u_priv_account field to show only the list of accounts where the Affected User is also the Account Owner?


2 ACCEPTED SOLUTIONS

Jon23
Mega Sage

@Luiz Lucena 

Try using an Advanced Reference Qualifier. Something like:

javascript:'account_status=true^sourceLIKEOU=Privil^u_account_owner=' + current.variables.u_requested_by;

Jon23_0-1734649550128.png

 

View solution in original post

Brad Bowman
Kilo Patron
Kilo Patron

If you change your Simple reference qualifier to Advanced you should see the encoded query for those conditions.  It looks like you can change the beginning of the reference qualifier to:

javascriptt:

with just one t, then the existing encoded query in quotes, appending to the end of it, inside the ending quote:

^u_account_owner=' + current.variables.u_requested_by;

This is assuming the u_account_owner field is also a reference to the user table.

 

View solution in original post

3 REPLIES 3

Jon23
Mega Sage

@Luiz Lucena 

Try using an Advanced Reference Qualifier. Something like:

javascript:'account_status=true^sourceLIKEOU=Privil^u_account_owner=' + current.variables.u_requested_by;

Jon23_0-1734649550128.png

 

Brad Bowman
Kilo Patron
Kilo Patron

If you change your Simple reference qualifier to Advanced you should see the encoded query for those conditions.  It looks like you can change the beginning of the reference qualifier to:

javascriptt:

with just one t, then the existing encoded query in quotes, appending to the end of it, inside the ending quote:

^u_account_owner=' + current.variables.u_requested_by;

This is assuming the u_account_owner field is also a reference to the user table.

 

Luiz Lucena
Mega Sage

Hi @Jon23 and @Brad Bowman  
Forgot to mention that, I tried that as well, but somehow, the field is not returning any value when I add that condition:

^u_account_owner=' + current.variables.u_requested_by;

 

Also, what would be the best practice in case the Affected User changes? 

EDIT: I think it was cache issue. is working now!
Thanks, both!