Restricting values in record producer reference fields

umaaggarwal
Giga Guru
Giga Guru

I have 3 fields in a record producer , user , role and group. all are reference fields . I want user to be selected as logged in user, groups which are available should be only user's group and roles which should be available are selected groups role

1 ACCEPTED SOLUTION

Hi Uma,

You can call like this

javascript:new FillGroup ().getGroupRoles(current.variables.your_group_var)

View solution in original post

10 REPLIES 10

Dubz
Mega Sage

You can use an onLoad catalog client script and use g_user.userID to populate the field with the logged in user. You can then use a reference qualifier to restrict what is returned in the other reference fields.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

For your logged in user field, you could use a default value like:

javascript:gs.getUserID();

 

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Akshata jamdar
Mega Guru

Hallo umaaggarwal,

 you can get currently logged in user using GlideSystem object javascript:gs.getUserName();

 

 

for getting group and role of currently logged in user you need to write script include and call that script include in advanced

reference qualifier of group and role variable .For this you need to create two different functions one for getting group id and other function is for getting role accordingly and call those functions in advanced referenced qualifier of group and role variables respectively.

 

If it helps you please mark this as correct and helpful.

 

Thanks,

Akshata

 

 

asifnoor
Kilo Patron

Hi,

Create a script include which returns the user groups. Another function in the SI which retruns the group roles.

Call these SI functions from the reference field as advanced reference qualifier.

For user, you can simply set up javascript:gs.getUserID()