Skip to main content
Skip table of contents

Wait Timer with a Variable Number of Hours

The Wait node enables a GlobalAction process to pause for a defined duration; however, it is limited to a fixed wait time per node. This workflow provides a method for configuring a variable wait period, measured in hours, allowing for greater flexibility. In addition, it demonstrates how to perform a basic API call using the iPaaS node and extends native functionality through http://mathjs.org, which supports advanced mathematical operations beyond those available in the workflow engine by default.

Workflow Summary

When a document enters this portion of the GlobalAction workflow, a wait time is set by the Set Process Field (1) node. The first iPaaS (2) node calls out to mathjs.org and converts the time from hours to milliseconds and stores the data in the variable Calculated Hours. The second iPaaS (3) node calls out to timeapi.io to get the current time and stores it in checkingTime variable. The workflow then Waits (4) 5 minutes before using the third iPaaS (5) node to get the current time again and storing it in currentTime variable. Finally, the Condition (6) node compares the currentTime to the sum of the Calculated Hours and checkingTime.

  • If Calculated Hours + checkingTime ≥ currentTime, the process continues down the True path.

  • If Calculated Hours + checkingTime < currentTime, the process returns to the Wait (4) node before being checked again.

This can be used as a stand alone process by adding Import and End nodes or used as part of a much larger process.

Screenshot 2025-08-20 101604.png

Variable Wait Timer Workflow

Workflow Node Configuration

Set Process Field (1)

Set the number of Hours after which the process should exit the timer loop.

This can be a set value, such at 1, or set using S9 Notation, such as {p_Document Wait} where the user can enter a number value into a process field called Document Wait allowing different documents to have different wait times.

Screenshot 2025-08-20 084924.png

Set Process Field Node Settings

iPaaS.png

iPaaS Node Settings

iPaaS (2)

Makes a request to mathjs.org and passes the value of Hours. The value is then converted from hours to milliseconds and returned to the workflow in the Calculated Hours variable.

Request

CODE
http://api.mathjs.org/v4

Format Expression

CODE
{"Calculated Hours":$number($replace($.result[0],"\"",""))}

Request Body: POST

CODE
  {
    "expr": [
		"format({p_Hours}/24*3600*1000, {notation: 'fixed'})"
    ],
    "precision": 2
  }

iPaaS (3)

Makes a request to timeapi.io to get the current time. The value is returned in milliseconds and stored in the checkingTime variable.

Adjust the Time Zone if needed.

Screenshot 2025-08-20 093447.png

iPaaS Node Settings

Request

CODE
https://www.timeapi.io/api/time/current/zone?timeZone=EST

Format Expression

CODE
{"value":[{"checkingTime":$toMillis($substring($.dateTime,0,23)&"+00:00")}]}
Screenshot 2025-08-20 093156.png

Wait Node Settings

Wait (4)

Sets how often the processes is checked to determine if the number of Hours have passed.

iPaaS (5)

Makes a request to http://timeapi.io to get the current time. The value is returned in milliseconds and stored in the currentTime variable.

Adjust the Time Zone if needed.

Screenshot 2025-08-20 093500.png

iPaaS Node Settings

Request

CODE
https://www.timeapi.io/api/time/current/zone?timeZone=EST

Format Expression

CODE
{"value":[{"currentTime":$toMillis($substring($.dateTime,0,23)&"+00:00")}]}
Screenshot 2025-08-20 093145.png

Conditional Node Settings

Condition (6)

Determines if the number of Hours have passed. If False, the process returns to the Wait (4) node to be checked again. This continues until the indicated number of Hours have passed. Once evaluated as True, the process continues in the workflow.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.