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

saran raj
Tera Contributor

Hi,

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.

Thanks!

 

5 REPLIES 5

saran raj
Tera Contributor

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

saranraj_0-1691656834100.png

 

Hello @saran raj , I think when it is changed to date and time it is taking seconds also into count and it is not matching the time i guess in wait for condition.

 

May be use timer activity for this as timer activity counts in every second to satisfy the condition and move the workflow forward .

 

Hope this helps 

Mark my answer correct if this helps you 

Thanks

Hi @Mohith Devatte, The condition worked for date selected for past and future dates but after changing the variable type to Date/Time from Date format, the timer is not working with time selected. The workflow should trigger when user selects the date and time in catalog form and based on this, the timer should trigger. Hope you understand. 

 

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @saran raj,

 

This must help !

 

https://www.servicenow.com/community/developer-forum/how-to-calculate-difference-between-two-dates-i...

 

I hope this help !

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect