Auto Populate user's email on catalog item field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I’m creating a Service Catalog item and I have a variable to capture the requester’s email. How can I automatically populate this variable with the logged-in user’s email when the form loads?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
@pathumh09586800 and @T_Mia , Navigate to the catalog item > email variable > related tab > Default value > javascript:gs.getUserID().getUserEmail(); > save and check
If this solution helped you Please Mark this solution as accepted and helpful as it will be helpful for other users as well.
Best Regards.
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@pathumh09586800 , @T_Mia , Have you gave it a try? Where are you stuck now?
If this solution helped you Please Mark this solution as accepted and helpful as it will be helpful for other users as well.
Best Regards.
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Saurabh, thank you for following up. Unfortunately the code you provided didn't work for me. However, Mark Roethof advised on a very simple way and it worked for me.
T Mia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I used this, it works, thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
it should be in your email address variable
If you want the Email address to change on selecting user then you can use Auto populate feature
Auto-populate a variable based on a reference type variable (Utah)
You can also auto populate the reference variable using this in the default value so that it populates logged in user
javascript: gs.getUserID();
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