Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Flow Designer condition using current time executes in UTC causing incorrect comparison with time

kumarakshay
Tera Contributor

Hello Experts,

We are trying to implement logic in Flow Designer for Visitor Management.

Requirement:
If the visitor's Expected Departure time has passed the current time, then we need to update an Overdue flag in the Visitor Registration record.

Current implementation:
We created a Flow Designer condition that checks whether Expected Departure is at or after the current minute.

Issue:
We noticed that the Flow seems to evaluate the time in UTC, while the Expected Departure value is being interpreted based on the user/session time zone. Because of this, the condition evaluates incorrectly and the Overdue flag is set to true earlier than expected.



Questions:

  1. Is this expected behavior for Flow Designer time comparisons?
  2. What is the recommended way to compare Date/Time fields with the current time in Flow Designer when time zones are involved?
  3. Is there a configuration or best practice to handle this within Flow Designer conditions?

Any guidance or recommended implementation pattern would be appreciated.

@Ankur Bawiskar @Arvid @_raj_esh 

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@kumarakshay 

My thoughts

-> yes it considers UTC

-> Why not run flow with "User who initiates the session"

-> best practice is to compare internal UTC-equivalent datetimes 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

Thanks Ankur for the clarification.


Just to confirm my understanding , when you mention comparing the
internal UTC-equivalent datetimes, do you mean that we should explicitly convert both values to the same timezone (UTC) using a script before performing the comparison?

For example, would the recommended approach be to use a Script step in Flow Designer and compare the values using GlideDateTime.

Just wanted to confirm if this is the approach you were referring to or if there is a better pattern within Flow Designer.

@kumarakshay 

yes use script step if using custom flow action or if you are using flow variable then get UTC for both and then compare

before that did you try Run as "User who initiated the session"

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@kumarakshay 

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! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader