Are global variables still valid in scheduled tasks steps?

I create a scheduled tasks a few months ago that uses global variables. Last week it started throwing an error:

Exception Message:
Exception: Variable “global” is not valid around position 1 for expression global.EngineerNameCurrent != global.EngineerNameHeader.

It appears to be unhappy with the usages within the “only perform this actions if…” condition.

When I look at the task history from the failed run it doesn’t even show the global variables as working object passed into the step.

I’m thinking further info may be required, but I’m a bit confused that something that I didn’t make code changes to stopped working with this error.

Hi @rbuck

Thanks for asking! Global variables are not available in scheduled tasks. This is because scheduled tasks don’t have multiple rules like mailboxes, so there’s no need or benefit to a global variable to share a value between rules.

I apologize that our recent update started to unexpectedly enforce the namespace in scheduled tasks in a way that is now causing this issue for you. The fastest way to resolve this is to remove the use of global variables in your task. If you have any trouble doing that, please share the task URL so I can check it out.

If you were using global variables in tasks in a way we hadn’t considered, please share how you were using them and we’ll see what we can do to either re-introduce them or otherwise accommodate that use-case.

Thanks for the quick response Travis. I switched all gobal. to custom. and things seem to work again. I was doing an iteration through an array of tickets as part of the scheduled task and each iteration is adding text to a variable. Instinctively global felt like a safer way to go with that, but I see now that it wasn’t really necessary. I appreciate the help!

Great! Thanks for confirming, and (again) our apologies that we introduced this unexpected change.

Thanks for clarifying the change… I had multiple scheduled tasks which also started failing with errors… It wasn’t that I needed them to be global variables, just that i would work with either. Got in the habit of using globals in case they were needed later. With the new beta UI, would you consider turning off the toggle between custom/global to prevent the global choice by accident since it isn’t supported?

Thanks for pointing out that the beta console allows using global variables. That will be fixed in the next update.