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
Hi @pathumh09586800 , you can use this script in the default value of the variable in which you want to populate the email of the logged in user.
Code : javascript:gs.getUserID().getEmail();
Write this code in the default value related list of the Email variable. This will work definitely.
Make sure to mark the 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 @pathumh09586800 , Hope you are doing well, Have you tried my given solution in your instance?
Also, you can accept more than one answer as solution.
If this solution I gave you earlier 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 @pathumh09586800 ,
to auto populate the user email we can set its default value using JavaScript code:
1) open variable form and set its default value
javascript: gs.getUser().getEmail();
check output on catalog item form.
aslo
we can write onLoad client script to set email field value.
✨If my response/article helped you, please mark it as the correct answer and close the thread — this helps other readers in the community.
Tejas Pravin Adhalrao
🚀 ServiceNow Developer | 🏆 SN Hackathon Finalist | 💡 Community Contributor
📧 Email: tejas.adhalrao11@gmail.com
🔗 LinkedIn: linkedin.com/in/tejas1018
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @pathumh09586800 ,
to auto populate the user email we can set its default value using JavaScript code:
1) open variable form and set its default value
javascript: gs.getUser().getEmail();
check output on catalog item form.
aslo
we can write onLoad client script to set email field value.
✨If my response/article helped you, please mark it as the correct answer and close the thread — this helps other readers in the community.
Regards,
Tejas
🚀 ServiceNow Developer | 🏆 SN Hackathon Finalist | 💡 Community Contributor
📧 Email: tejas.adhalrao11@gmail.com
🔗 LinkedIn: linkedin.com/in/tejas1018