This tutorial will guide you through the creation of steps in your process that allow for the calculation of a date or a batch of dates based on an input date.
You can also use our step templates to create the required steps
Step 1: Create Date Input and Number of days to add/subtract
Access your process and create an action step with the following actions:
"Date Input": The date where you want to apply the calculation.
"Text Input - Short": This will serve to submit the days that you want to add/subtract when running your process.
In case of multiple dates, please enter multiple actions.
Tip: to subtract days, enter a negative number, i.e. -5, when running your process instance. For adding days its not necessary to type the number as +5, simply type the number.
Step 2: Create the date calculation step
Create an integration step after the step with the input Date and number of days. Configure the integration step.
Method: POST
URL: https://integrations.nextmatter.com/g/utils/calculatedate
Headers:
Key | Value |
Content-Type | application/json |
Body:
There are two possible formats:
Single date set:
date: Enter the date by using the Data Reference of the previous step date action.
days_to_add: Number of days to add or remove. To remove please add a minus, i.e. -5
enable_business_days: Optional. If set as true, the calculation skips Saturday and Sunday. As in the example, adding 1 day to a Friday leads to next Monday. This feature is not available when removing dates. Therefore, it will return an error if days_to_add is negative, and enable_business_days is set to true.
Structure:
{
"date": "<DATE>",
"days_to_add": "<NUMBER OF DAYS>",
"enable_business_days": <TRUE or FALSE>
}
Example:
{
"date": "2022-07-01",
"days_to_add": 1,
"enable_business_days": true
}
Batch set:
Array of single data set.
Example:
[
{
"date": "2022-05-01",
"days_to_add": 1,
"enable_business_days": true
},
{
"date": "2022-06-01",
"days_to_add": -5,
"enable_business_days": false
},
{
"date": "2022-06-01",
"days_to_add": 2
}
]
Response:
By using "Response data for use in later steps" you can save the resulting date so that it can be data referenced by later steps.
Example for a single set:
{
"date": "2022-07-04T00:00:00"
}
Name | Value |
calculatedDate | $.date |
Example for a batch:
[
{
"date": "2022-05-02T00:00:00"
},
{
"date": "2022-05-27T00:00:00"
},
{
"date": "2022-06-03T00:00:00"
}
]
Name | Value |
calculatedDate1 | $[0].date |
calculatedDate2 | $[1].date |
calculatedDate3 | $[2].date |
Example of Integration step configuration: