We need to show data from user and group in a single reference field

Dileep Kumar2
Tera Contributor

HI Guys,
I have a requirement where I need to populate both user and group data in a single reference table.
We have a managed by field which is reference and it should show data both from user and group table.

I just want to know whether this is even feasible to do?

Appreciate your thoughts in this!!!

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@Dileep Kumar2 

both the tables are different

only 1 table holds this information i.e. sys_user_grmember

It tells which user is part of which user group

AnkurBawiskar_0-1767948655393.png

 

💡 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Mark Manders
Mega Patron

You can't. A reference/list field only references one table. You could create a custom table adding all groups and users and use a custom display field to make sure the names are shown, but the extra needed logic behind it would be terrible.
Just use a 'managed by user' and a 'managed by group' field and make them both mandatory when both are empty and not mandatory when one is filled. That way you can use both tables. Any notifications go to both fields.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

SohamTipnis
Tera Expert

Hi @Dileep Kumar2,

 

Users (sys_users) and groups (sys_user_group) are different from one another.

To fetch both the tables, we have Group Member (sys_grmember). This table is useful if you want to allocate one role to multiple users.

 

If you find my answer useful, please mark it as Helpful and Correct ‌‌‌‌😊

 

Regards,

Soham Tipnis

ServiceNow Developer ||  Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10

Dileep Kumar2
Tera Contributor

Hi @Ankur Bawiskar ,
Thanks for the response. I am aware of the sys_user_grmember table.
How ever the use case is we need to choose managed by as either a user or a group.
So if we user grmember table only it shows whats the display value for that group.


That's the reason we are looking if there is any possibilty to show groups and users for managed by field.

Else we need to create a seperate field as Managed by group, which allows them to choose groups.