- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 10:37 AM
I want to set current user (logged in) into String field and as well as in another field want to store time as per their time zone in service catalog. How should i do this?
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 10:40 AM
Hi there,
You could use a default value in the Single Line Text variable, with javascript:gs.getUserDisplayName(); and javascript:gs.getUser().getTZ();
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
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
06-25-2020 10:40 AM
Hi there,
You could use a default value in the Single Line Text variable, with javascript:gs.getUserDisplayName(); and javascript:gs.getUser().getTZ();
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
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
06-25-2020 10:43 AM
Hi Rojerio,
Go to the Default value of both the variables.
In the variable you will have the
For user name
javascript:gs.getUserDisplayName();
For timezone field:
javascript:gs.getUser().getTZ();
Thanks,
CB

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 10:49 AM
Try this
javascript:gs.getUserDisplayName();
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Pranav

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 10:53 AM
Hi ,
Here is a link which will help you.
If it helps,Please mark ✅ Correct and 👍 Helpful.
Warm Regards,
Milind