Reference field

Mahesh4
Tera Contributor

Hi All,

 

we have 2 variables one is choice and other is reference variable(group records) ,

upon selecting choice 1 in variable 1,in variable 2 it should show only groups ,if current logged in member is owner of any of the group. Kindly help.

 

3 REPLIES 3

Hemanth M1
Giga Sage
Giga Sage

Hi @Mahesh4 ,

 

What variable 1 choice contains , 

For variable 2 : whats the field type of Owner, if its referance 

you can do below (Replace Manger by Owner)

 

If you are looking groups whose owner is logged in user (Change of Variable 1 doesn't make sense).

 

HemanthM1_0-1704218084464.png

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi @Hemanth M1 

Thank you for your response ,

Actually variable 1 is select box  and it has 3 choices like A ,B C.

and variable 2 is reference type of group table, so if logged in user selects variable A or B in variable 2 it should show all the groups but if he selects C in Variable 2 it should show only groups where logged in user is owner of.

Ankur Bawiskar
Tera Patron
Tera Patron

@Mahesh4 

in the 2nd variable add this in advanced ref qualifier. Ensure you give correct variable name and choice value and not choice label

I am assuming if user selects 2nd value from select box then it will show all groups.

Please enhance it based on your customer requirement

javascript: var query=''; if(current.variables.variable1 == 'choice 1') query = 'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getMyGroups()); query;

If my response helped please mark it correct and close the thread so that it benefits future readers.

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