Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to set default group

hemantnh
Tera Expert

i have created a default group fields in the user app. if user have multiple group. i want to select one group as a default  group. so how to get all the group details for that default group.

 

find_real_file.png

1 ACCEPTED SOLUTION

Greetings Hemantnh,

 You will need to write or find a function that takes a sys_id or user_name and returns groups. Glide User does this, but you will need to use an advanced reference qualifier to do something along the lines of - 
var me = gs.getUser();
me = gs.getUserById(current.user_name);
me.getMyGroups();

Or find or write a script include that you will call from the reference qualifier - and pass it current.user_name and get back list of groups. 

-Andrew Barnes
Join me at Developer Blog

View solution in original post

4 REPLIES 4

Uncle Rob
Kilo Patron

Unclear what you want.  Do you want the system to select a group at random?  Or according to a condition?
If not, then why aren't you populating it manually?

by click on the default group lookup, i wan the list of group,user part off, so that i will select manually one group as default group.

Greetings Hemantnh,

 You will need to write or find a function that takes a sys_id or user_name and returns groups. Glide User does this, but you will need to use an advanced reference qualifier to do something along the lines of - 
var me = gs.getUser();
me = gs.getUserById(current.user_name);
me.getMyGroups();

Or find or write a script include that you will call from the reference qualifier - and pass it current.user_name and get back list of groups. 

-Andrew Barnes
Join me at Developer Blog

Slawek_Radziewi
Kilo Sage

What details? You just populate group manually and then you will be able to see "i" icon and see details for it.