Stop the Cron node

Hello community,
please how can I stop the Cron node?
the purpose is to stop the cron when the condition is approved.
I tried to use the IF node after the Cron node, but the cron node doesn’t work in this case.
if someone can help me, how to do that I will be very thankfull.
Best,

Currently, sadly no such functionality exists.

There are currently just two possibilities I can right now think off:

  • something hacky like deactivating the workflow by using the internal undocumented API that the editor-UI uses
  • you would have to have an IF-Node afterward and ignore all further executions (which seems like you apparently tried but can not think of any reason why it should not work)

Hi @Zakariae_Elhomaidi! Can you give us a little bit more info on what the condition to stop the cron?


Hi @jan , @sirdavidoff,
I tried an IF node after the Cron but it didn’t work, the goal is to resend the mail until I get a return and this return will be the condition to stop the cron.
how can I do that?

Oh as far as I understand, the triggers coming from The Hive are the conditions to stop the execution, right?

In this case, this wouldn’t work as n8n would treat these as completely separate executions.

Let me try to clarify: if you are saving the successful executions and check your execution logs, you will see that the workflow runs multiple times. Some of them based on the Cron node, which simply causes the execution to work (and send the email) and some executions start from “TheHive Trigger” node, making them completely separate.

In this sense, we can understand that n8n is “stateless”.

If you want something like this, you’d need a database or another external storage to keep this type of control and query this external service about triggers from The Hive.

In the end, these could work as 2 entirely separate workflows:

Workflow 1: cron based, query database to see if The Hive trigger was ever received. If not, send email
Workflow 2: Receive The Hive triggers, save them to database and take necessary actions

Please let me know if I got it all wrong.

2 Likes

no, maybe I didn’t explain well, what I’m trying to do: TheHive Trigger will get the created cases, and according to their severity it will send an email automatically to the client, if we don’t receive an answer from him, the mail will be sent again, like this until we get a return from the client.

Hey @Zakariae_Elhomaidi,

I would do something like this:

  1. After the Cron node, add a Gmail node or the Outlook node (or a relevant node) to fetch an email from the user.
  2. I will connect this node with an IF node which will check if there was any result provided by the previous node.
  3. If there was a response from the user, I would do nothing.
  4. If there was no response, I would send an email to the user.

This cycle will continue, at the time you specify. This won’t stop the Cron node from executing if you have received an email, but with this logic you will only send the email if the user hasn’t responded back.

Let me know if you have any questions :slight_smile:

Hey @harshil1712 thanks for your feedback,
the problem is when I add a IF node beetwen the Cron and the Send email node,
the Cron doesnt work, or it work just for one time.

Hey @Zakariae_Elhomaidi!

Can you check the configuration for your Cron node? Also, are you running your workflow in production (is your workflow active)? If yes, you can check the executions from the Executions list (assuming that you haven’t turned it off).
I would also like to mention that, if the IF node returns false no operation will be performed as you have configured it in the workflow.

Hello Community, I’m still stuck
The configuration on the Cron node, I tried to run the workflow in the test and production mode, I still get the same error, and the IF node return true.
I cant understand why when I add a IF condition after the cron node it work just once, I cheked the Executions.
When I delete the IF and connect the Cron directly to the Send mail node, there is no way to stop the Cron then.
please I’m still looking for a solution!

Hey @Zakariae_Elhomaidi!

What condition are you checking in your IF node?

I would connect a Gmail node or an Outlook node after the Cron node. I would get all the messages from either of the services and using the IF node to check if I received a response to my email. If I didn’t I would send an Email, and if the user replied I would connect the false branch to the NoOp node.

Hey,
I try it but it doesnt work,
the use of two trigger nodes in the same workflow will not cause problems?
I use TheHive Trigger and Cron, thehive for getting the new cases, and the Cron is used to set the date for sending emails.

Hey!

I generally prefer to have separate workflows for my Trigger nodes. So you can definitely do that. However, I don’t think the issue is with having two Trigger nodes in the workflow.

Can you share your workflow? In the workflow that you shared earlier, there is no Gmail node or Outlook node that fetches emails. You just have an IF node. Without fetching emails, I am not sure how will you be able to check if the user has replied to the email or not.

Hello,
I would like to try the Outlook node, but I have problems with the credentials.
I can’t log in with OAuth
Sans titre2

Can you please let us know what error do you get when you try to connect to Outlook (click on the button to sign in to Outlook)?

There is the error


even If I active the retry on fail and new credentials

Did you follow all the steps mentioned here: Microsoft | Docs?

You might be getting this error because Microsoft is not able to reach the callback URL. You might wanna use a Ngrok or another tool and set export WEBHOOK_TUNNEL_URL=NEW_URL.

Yes I follow all the steps.
I dont know how to use Ngrok or another tool. I didnt find this mentioned it the docs

Sans titre3
I tried the command export WEBHOOK_TUNNEL_URL=localhost this is the error message

localhost is not valid URL. A valid URL would be for example http://localhost:5678/

Here the documentation: