Global Variables in the Rule Expression

Is anyone else using global variables within the Rule Expression. The Rule behaviour seems to be different from the conditions in the Steps.

At the step level, the working format is:

We have tried the same format in the Expression at the rule level to no avail. Also tried {{global.AlertType == “Backup”}}

It seems like the issue is evident when the rule runs (is that right)?

Can you describe what’s happening when the rule runs? Do you get an error, or is it not behaving as expected? Or something else?

I’d like to replicate this - can you share specifics to do that?

Sure. I’ve created a rule that looks at the subject of the email. if it contains a string then it defines a global variable as “Backup”.

I then want the next rule in the list to run if global.AlertType == “Backup”

If I put this rule in the step in the next rule it runs fine.

If I put it into the rule expression in the same format

When the email is parsed I can see the AlertType is set to Backup.

But the rule just doesn’t run. It completely skips it and is not mentioned in the History

Where as it should be running the rule “Azure Backup - Extract : Information from email”

image

If I leave just the subject check in there and remove the global.AlertType value it runs it.

Thank you - that’s exactly what I needed.

This is a defect. The eligible rules that can run are determined at the beginning of execution before any rules run, and don’t take into account changes to the variables mid-runtime. When the rule expressions are evaluated, global.AlertType is null.

This will be fixed in the very next release.

In the mean time, you can remove the expression in the rule and add an action to the rule. The action should be “Stop processing this rule” only if global.AlertType != “Backup” (the opposite of the expression on the rule).