Populate Manager variable based on selection of User variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I'm working on a catalog item that has two variables
1. User -> Reference to sys_user table
2. Manager -> Select Box
The requirement is when a user is selected then Managers select Box should be populated with the Manager(s) of that user.
Some Users may have the same display name. example: three users named Abel, but they have different managers. Therefore, I want to populate all three users managers on the Manager Variable. I tried but null value is passing onto the client side however on server side I'm getting all the managers. Could anyone please guide me where I did wrong.
Server Side Script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
not a good idea to have managers as select box (drop down).
Since 1st variable is reference you can select only 1 User and 1 User will have only 1 Manager
Why not have 2nd variable as reference and make it readonly?
You can use auto populate feature to populate and no scripting required
Auto-populate a variable based on a reference type variable (Utah)
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Ankur Bawiskar ,
Thank you for responding.
On the user table, if there are 3 different users with same name then I would need to populate 3 user managers on the Manager field due to that I created select box variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
but reference variable can hold only 1 user, so you expect user to select only 1 user
That user's manager can be auto populated in the next manager reference variable
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @ramireddypa This can be achieved by making the "Manager" variable as look up select box type. No Scripting required.
Change the "Manger" type to look up select box and under "Auto Populate section" select the dependent question as "User" and dot walk to manger field.
This can solve your issue.
Thanks, and Regards
Mahesh
Please mark this response as correct or helpful if it assisted you with your question.