Step 6: Time Action
We are now going to add a Time Action. This will tell us how long ago the package was delivered. We will use the last update date output from the UPS action for the date.
Add Time Passed Action
Click on the plus below the Delivered path and then enter time in the Actions search bar. Select the Check Time Passed Since Some Date in Business Days. This action measures how long it's been since a particular date counting week-days only.
This action has 2 inputs: Time Unit and Past Date.
Time Unit determines how you want to measure the time, let's select days.
Past Date is the date from which we want to measure the time until now. As we want to know how long ago was the package delivered, we are going to point it to the date of delivery from the UPS action. In the Source type, select UPS Track & Trace activity. In the Outputs dropdown select the Last Event Date output. In case of a Delivered status, the last event date is the delivery date.
Now you can rename the activity to make it more contextual like "Business Days Since Delivered"
Add Branches
Now that we know how long ago was the package delivered, let's make a few paths to capture different scenarios.
In the first path we will cover the scenario if a package was delivered less than 5 business days ago. Add a template action and a condition on Units of Time Passed output. For the operator, use Smaller and for the Value just type in 5.
In the second path we will cover the scenario if it was delivered 5 or more business days ago. We can use the Otherwise condition for that. The Otherwise condition is a fallback condition that will match if no other path conditions matched. In this case it means, if the first path was not selected then the second path will run.
Add Template Responses
We can now write some template responses for each of the scenarios we just added. Just edit the templates in the template activities you and feel free to add some placeholders that can reference actions in the path above.
Updated 12 months ago