How do I reference both the "Assignment Group" and "Assigned to" on the same field (Record Producer)

F_bio Santos
Kilo Sage

Hi everyone, Im trying to make a field that references both the "Assignment Group" and "Assigned to" so that when I click on the field and write somethink like "Dev Team" it shows both the Group and the users that are a part of it. 

9 REPLIES 9

@F_bio Santos 

your variable is referring to table sys_user_grmember?

If yes then you will require a custom field which is of type string and make it calculated

populate it as this current.group.name + ' ' + current.user.name

Then make this new field as Display=true on the table

OR

since you are making it as reference variable you can add variable attributes to show value of both the fields when user types in something

Example

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=category;serial_number,ref_ac_columns_search=true,ref_ac_order_by=name

Variable attributes sections

AnkurBawiskar_0-1690465026577.png

 

Output: I have added category and serial_number as extra fields to be shown along with name

AnkurBawiskar_1-1690465026583.png

Similarly for your table add this in the variable attributes for that variable

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=group;name,ref_ac_columns_search=true,ref_ac_order_by=name

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

sushantmalsure
Mega Sage
Mega Sage

Hi @F_bio Santos 

By this time you might have figured it out that its not possible to make a field referencing to 2 different tables where parents of those tables are not same. and in yours case definitely its not possible.

But instead, you can refer to table named  'group Members' (sys_user_grmember) which contains relationship/membership of user. Now with this new referencing table you will be able to find groups and people present in that group .

 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

And what would I use as a "Type" for the variable of the Record Producer @sushantmalsure ?

I was thinking "Select Box" but it wont work because it only let's me chose one field from the (sys_user_grmember).

@F_bio Santos 

Did you get a chance to check my above response?

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

I am Little confused with your ask. Can you add a screenshot here?

 

If you want multiple columns to be visible from membership table then make Type: Reference , reference : sys_user_grmember and in reference qualifier : ref_ac_columns=user;group,

 

if you want to select multiple values from members table then you can have Type : List Collector ,reference : sys_user_grmember and just add variable attributes : glide_list .

This will create a glide list and you will be able to select multiple records.

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure