- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 05:12 AM
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 07:08 AM
Hi Uma,
You can call like this
javascript:new FillGroup ().getGroupRoles(current.variables.your_group_var)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 05:21 AM
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 as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 05:27 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 05:49 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 06:06 AM
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()