- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi everyone,
I ran into a timezone issue when using GlideTime APIs inside a Flow Designer Custom Action script.
Scenario
User timezone: Europe/Helsinki
Script is written inside a Custom Action (Script step) in Flow Designer
I am using a GlideTime object and calling:
var gt = new GlideTime(someTimeValue);
var hour = gt.getHourLocalTime();The returned hour was wrong. To investigate further, I checked the session timezone inside the script:
gs.getSession().getTimeZoneName();Interestingly this returned:
America/Los_AngelesInterestingly, when I run the same logic in Background Scripts, the timezone behaves correctly and respects the user's timezone.
Questions
Is this expected behavior because Flow Designer run in a system execution context instead of the user’s session?
If so, what is the recommended way to correctly calculate user-local time (e.g., using getHourLocalTime()) inside Flow Designer scripts?
Solved! Go to Solution.
- Labels:
-
Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
when flow runs with system then it picks system timezone mostly America/Los_Angeles by default
background script uses the user's timezone who runs that script.
so always recommended to convert that to your timezone which you require
OR
Set the Flow to Run as User who initiated the session to pick that user's timezone
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
when flow runs with system then it picks system timezone mostly America/Los_Angeles by default
background script uses the user's timezone who runs that script.
so always recommended to convert that to your timezone which you require
OR
Set the Flow to Run as User who initiated the session to pick that user's timezone
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Great. Thanks Ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
So how did you solve this?
It would be great if you share the approach and logic so that it helps other members in future
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
