How can I keep the workflow active for the next 3 hours only after being received trigger from another workflow

Describe the problem/error/question

Hi , I have a requirement , where in I can trigger the workflow with the help of another workflow (Execute workflow) , after being triggered the first node is Jira node to fetch newly created Jira issues of a certain condition, but this needs to keep a watch on new issues only for next 3 hours from the time it received a trigger from execute workflow? Is this possible?

Even better would be if can simply use Jira trigger to look for new issues for 3 hours , but I assume I cannot link this Jira trigger with execute workflow from the other workflow, correct me if i am wrong? Please help .

@Jon Please suggest.

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hello @Siya,
I try my best to give you an answer even if I am not @Jon :wink:

First things first:
Workflows can only be activated by one trigger at a time. So there is no chance to start an execution by the workflow trigger and then get another trigger with the jira trigger node for the same execution. This would start a second execution.

What you can do:
It is possbile to wait for 3 hours with the wait node betwenn the workflow trigger and the jira node like this:

Cheers.

Hi @nico-kow ,

Thank you for your quick response! :slightly_smiling_face:

Yeah this one looks good , it may not be ideal for me , because the reason for this workflow was to get notified as soon as there is a issue in the very first 3 hours itself , the solution you suggested would give us the list of all tickets that was generated in last 3 hours at once at the end.

Hey @Siya,

You could start a lop which is checking for new issues after X minutes/seconds.

For example if you check every 5 minutes for new issues, you need to loop 36 times to wait 3 hours longest.

In the if node you need to check if either the loop has reached 36 times or if you get any jira issue.

Something like this:

The $runIndex gives you the count of loops and the other condition depends on your specific needs .

Cheers.

2 Likes

Hi @nico-kow , The idea works like magic in terms of keeping the flow active for 3 hours but I have one problem so I kept a check for Jira node to look for issues that are 5 mins old with each loop it runs , with every loop number increases I get duplicate values of issues created . Any idea why this might be happening ? Here I am keeping the wait for 5 seconds just to see the flow working , Ideally there are just 3 issues that are from last 5 minutes , so it should ideally give me 3 items with each loop , where as you can see it is duplicated with each run.
Thanks again for the help.

I added a item list node to remove duplicates , its just a hacky workaround , may be if you have better alternative , please suggest.