Timer with start date and time in workflow is not working.

saran raj
Tera Contributor

Hi @Ravi Chandra_K  @Ankur Bawiskar 

I am using a timer with wait for condition as start date and time (PST hours). I used the below script for start date condition and it worked but when I changed variable type to Date/Time, the timer condition is not working when user selects date and time (PST hours). Could someone please help with the below script?

 

var start_date = new GlideDateTime(current.variables.start_date);
answer = gs.dateDiff (gs.nowDateTime(), start_date,true);

 

The above script is working for selected date but not working for data along with time (pst hours). Please provide your suggestions.

 

Do I need to set any time zone like mentioned in the screenshot to trigger start for date and time? Please assist. 

saranraj_0-1691717387130.png

 

Thanks!

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@saran raj 

try this

https://www.servicenow.com/community/itsm-forum/add-hours-to-a-date-field-on-a-wf-timer-script/m-p/5... 

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

Hi @Ankur Bawiskar 

The link which you shared is useful for setting up a selected date to trigger the workflow but in my case, the workflow should trigger based on user selection in catalog form with respective to start date and exact time mentioned by user. Any suggestions on how to achieve this condition?

@saran raj 

Did you check that link has any place to use dynamic value for date/time?

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

@Ankur Bawiskar I could not find in link to use dynamic value but my below script is working for start date and exact time but I am not sure which time zone it is working. How can I check on what time zone the workflow triggered?

 

var start_date = new GlideDateTime(current.variables.start_date);
answer = gs.dateDiff (gs.nowDateTime(), start_date,true);