How to wait for a date (Service Catalog variable) using the 'Wait for condition' workflow activity

Joe Weisiger1
Giga Contributor

Hello,

I have a Service Catalog item with a date variable.  I want to wait for that date before proceeding on in the workflow using the "Wait for condition" workflow activity.

I have tried multiple conditions but I cannot get this to work correctly.

In the condition, I have:

Variables : Catalog Item Name : Variable Name : on : Today

Can I do this from the condition or do I need a script, and if I need a script what would that look like?

Any help is appreciated.

Thank you,

Joe Weisiger

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

Hello

Use the timer activity and use the below script:-

var endDate = current.variables.variableName.getDisplayValue(); answer = gs.dateDiff(gs.nowDateTime(), endDate, true);

Please mark answer correct/helpful based on impact

View solution in original post

2 REPLIES 2

Willem
Giga Sage
Giga Sage

Hi Joe,

As per the description of Wait for condition workflow activity:

To pause a workflow for a timed duration see Timer workflow activities.

 

It might be best to use a Timer workflow activity and set that Timer based on either script or date/time field.

 

  • A date/time or duration field: The duration is based on the Field value and the Wait field.
  • Script: The duration is based on a script that returns the number of seconds.

 

Refer to: https://docs.servicenow.com/bundle/rome-servicenow-platform/page/administer/workflow-activities/refe...

Saurav11
Kilo Patron
Kilo Patron

Hello

Use the timer activity and use the below script:-

var endDate = current.variables.variableName.getDisplayValue(); answer = gs.dateDiff(gs.nowDateTime(), endDate, true);

Please mark answer correct/helpful based on impact