Schedule node and usage expressions

Describe the issue/error/question

On a Schedule Trigger Node If I select ‘Trigger Interval’ to be minutes, I know I can select a fixed or expression as value. In the past I’ve always used ‘fixed’. I’ve been trying to figure out from an attached code node what the settings were that used on the schedule node. Is that possible ?

I tried to see what if I changed from ‘Fixed’ ‘Expression’ I can’t figure out what I can do in the expression, because I’ve tried to return a json string in the expression and that killed the platform, spawned executions several in a second, and not minutes that was selected from the drop down. I won’t post the simple scheduled trigger node because I can only describe it as the Schedule Trigger from hell if you ‘Activate’ it.

What is the error message (if any)?

No error … just loop of death.

Please share the workflow

I don’t think people would like me if I pasted the 2 node workflow…
but it had a return json string in the expression of the Schedule Trigger.

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.216.0
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: scheduled
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @0101binary0101,
I did not understand what you are trying to achieve with expressions in the Schedule Trigger node, but here is an example workflow how you could read the parameters from the Schedule Trigger later on in your workflow.

If you are using expressions in the schedule trigger node they should return numbers values like minutes.

@marcus

Ok I think I see where the set is working … I tried to use a code node to set a variable but I was thinking which gets executed first ?, because the schedule node doesn’t allow you to supply an input node per say… Almost a chicken and egg situation.

I wanted to set a time interval that I could use later on, in another node.

@marcus

Sorry for continuing this question about the use of ‘expressions’ in a schedule trigger , I’m guessing I can’t influence the ‘schedule’ timing from something else e.g. a set node ?

e.g. In the ‘Expression’ of the schedule, specify a value from a set node ? For example this sends n8n when ‘activated’ into a nose dive, and I have to restart the container… It’s a box killer IMHO that anyone could activate, so why have ‘expressions’ on schedules ?

After stopping and restarting the N8N container after just a few seconds I can see the failed schedules:

I’m just trying to get my head around the purpose/usage of ‘expressions’ on a schedule node.

@marcus can probably give you a better technical reason but I suspect only whacky / bad things can happen by trying to use dynamic data in the schedule trigger. In short, the trigger starts the workflow BUT it’s predicated on a dynamic data that is only available/ calculate after the trigger starts. So that’s probably why you’re getting some weird results.

With that in mind however, the Schedule trigger’s parameters probably should not have expressions available; and that would improve the UX. @marcus do you agree? Can you see from technical side a valid scenario where a user would plausibly use expressions in Schedule trigger?

1 Like

@maxT I generally agree with your assessment. I can’t really come up with a valid scenario right now, but in an upcoming feature like global variables it could make sense to use expressions.

@0101binary0101 Changing the scheduler time dynamically while the workflow runs is not supported and would require drastic changes in the underlying architecture. Depeneding on what you are trying to do you could add IF nodes or similar to your workflow to only continue execution on certain conditions.

1 Like

@marcus It was to see if it were possible to have a schedule that I could alter via a workflow. I know that I could abuse a 1min schedule with having a variable wait node just after the schedule… but it was bugging me why the expression block was on the scheduler if I can’t do anything with it.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.