Timer activity in workflow - Trigger in GMT time zone irrespective of user's time zone

saran raj
Tera Contributor

Hi all,

I have a requirement using timer activity, where the workflow should trigger in GMT time zone when user selects time on form irrespective of the time zones. I used the default configuration of SNOW, but timer activity is working by default by GMT hours, but every time user should change the instance time zone to GMT and then submit the form. But this is creating a chaos. Is there any way to trigger the timer in GMT with irrespective of instance time zone for global users? Could someone please help me out?

 

Thanks,

Saran.

9 REPLIES 9

Hi @Niklas Peterson 

The timer activity is trigger and not considering GMT time zone as per your suggestion.

Users submit select date and time using a variable 'Start Date' ( type- Date/Time) 

saranraj_0-1694494541574.png

The requirement is to convert date & Time into GMT with irrespective of the time filled in form by global users.

 

Could you please provide any insights on this?

 

Thank you,

Saran.

Hi,

If that would have been a field on the record then you could have used the Time based on  "A Date/Time or duration field" but I assume it is a catalog item variable? Then you need to use Time based on Script instead.

NiklasPeterson_0-1694497339212.png

 


The script expects an answer in seconds to wait. So the trick here is to capture the start date from the variable and calculate the number of seconds from "now" to that start time (in GMT). 

 

Regards,
Niklas

Hi @Niklas Peterson 

Yes 'Start Date' is a catalog item variable. I have already used timer based on Script with below screenshot.

saranraj_0-1694497860059.png

When I used this script, the timer activity is working in GMT but users have to change the instance time to GMT time zone and submit the form. 

 

Is it possible to write script for this requirement. Could you please guide me?

 

Thank,

Saran.

Hello again,

GMT is essentially UTC. So try something like this.

var start_date = new GlideDateTime();
var now_date = new GlideDateTime();
start_date.setValueUTC(current.variables.start_date.getDisplayValue(), "yyyy-MM-dd HH:mm:ss");
now_date.setValueUTC(gs.nowDateTime(), "yyyy-MM-dd HH:mm:ss");
answer = gs.dateDiff (now_date,start_date,true);

 

By using the display value of the variable we don't care which time zone it is actually using and we can push that as a UTC value.

 

Regards,
Niklas 

Community Alums
Not applicable

Hi @Niklas Peterson 

Thank you so much for the info! It worked as expected!!

 

Regards,

Saran.