How to use time as a condition

  • 23 January 2019
  • 1 reply
  • 5 views

Badge +7

I need to be able to create a workflow that evaluates the create date/time to determine if it was created between 10 am and 2 pm today, to take some action on records created during this period. 

The times are fixed, but the date, of course, needs to be variable.  How can I use date/time in a condition to check this?


1 reply

Badge +7

I figured out how to manage this, and want to share the solution in case anyone else needs to accomplish something similar.  It requires 3 calculate date actions. 

The first I set to the current action execution date and checked the include time box.  I stored this in a date/time variable called varCurrActionTime:

varCurrActionTime Calculate Date Action

2nd calculate date action, sets my 10 am variable. I used the current date workflow context value, which defaults to 12am, and added 10 hours to it. This I stored in a date/time variable named var10am:

var10am calculate date action configuration

My 3rd calculate date action sets my 2 pm variable.  I used the current date workflow context value, which defaults to 12am and added 14 hours to it.  This I stored in a date/time variable named var2pm:var2pm calculate date action configuration

Once I had all these variables, I used them in my condition:

Condition Action Configurations

I wrote all the values to history:

History showing the values of variables

Hope this can help someone else to use execution time as a condition.

Reply