Getting user email based on selected user in another field on a form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:06 PM
Hello everyone!
I seem to have run into a development issue with my work, specifically with the creation of an onLoad Catalog Client Script for my form.
I currently have a dropdown field where you select the name of any user within the organization that is prepopulated with the name of the logged in user when the form loads.
I want another field within the form (user email field) to get the user email automatically when the form loads based on the user that is in the user dropdown field. I'm having issues with this.
Are there any ideas on solutions? Please see my code attached.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:36 PM
Hi @Philip Conforzi,
Please check if the field definition page has "Auto-populate" option then you can just give the reference of user variable and select the Email in dot walk field. User field should be reference type.
Sample form :
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:38 PM
Hi @Philip Conforzi ,
As you are working with a catalog item, and you want to auto populate the variables based on the loggedin user (which you might select as requested for or any other variable).
For Autopopulating the variables you are not required write any code.
From ServiceNow Utah release we have an option called Autopopulate on the variables form, using it you can autopopulate the values into variables as required @Philip Conforzi.
Naviagte to your catalog item and open the variable which you autopopulate the data,
Seelect the dependent question and give the dot walk path for it and its completed @Philip Conforzi .
Try this No-Code approach once @Philip Conforzi , It might help you in assisting your requiremnt.
If my response helps you in any way please mark my response as helpful and accepted solution @Philip Conforzi .
Thanks & Regards,
S. Lakshmikanth Gupta.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 06:02 PM
Hey thanks for your reply!
This is actually a very interesting solution. unfortunately, the field I need to reference is not coming up as an option within the "Dependent question" field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 06:06 PM
Hi @Philip Conforzi ,
Can you please provide more information about the fields you are having and the fields were you want to auto populate the data.(from which field you want to populate the data as well)
if i have that data, i will try to provide better assistance to you @Philip Conforzi
Thanks & Regards,
S. lakshmikanth Gupta.