Hello!
I have been trying to get an automation working for weeks now (only runs on production deploy, so there's no way to test quicker) and am stuck on what the issue could be, I suspect it has something to do with the JQL string matcher "~" on a smart value.
The main culprit is the highlighted if statement in this screenshot:
...
A ticket that went throught this flow ended like so:
Some more context on why this rule is build this way:
Does anybody have any idea how to fix this if statement?
Hi @Tuur Lievens (TME) -- Welcome to the Atlassian Community!
Would you please post your complete rule in a single image, perhaps using a scrolling page capture? That will help see the overall context to help explain what is happening.
Until we see that...
Perhaps add some additional writes to the audit log to confirm the values your conditions are testing. That will help to compare to your conditions.
Next, the CONTAINS ~ operator is defined for JQL although I wonder how it works (or not) with smart values like {{deployment}} and its attributes which only exist when the rule is running after those deploy triggers. I recommend testing by using text functions to extract the values needed, or use conditional smart value logic.
For example, use left(), substringBefore(), or match() to extract (within conditional logic), saving those to created variables before the first rule conditions, and then use those variables in smart value conditions.
Kind regards,
Bill
Hi Bill
Thanks for taking a crack at the issue so quickly!
I'll give that startsWith function a try.
I also didn't know you could create variables, that might help me simplify the setting as well.
Here's the full screenshot, brace yourself...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, and...
The automation audit log is not super helpful regarding conditions, particularly with such a complex rule. And the ability to nest if / else blocks is a very new feature, so perhaps this one is pushing it to the limits. By my count, there are 10 paths through it, and the log you show does not seem to match up with rule flow (or I just miscounted).
To help know what is happening, I recommend:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
My apolagies for the late answer, like I said, I only have the ability to test every few weeks due to this being linked with a deploy.
I was able to simplify the logic a lot with the help of the "create variable function" you mentioned. Due to that it was also feasible to move away from the JQL statements.
This is what I ended up with, however, as marked in red, the "create variable" action does not seem to work? The value is empty, I tried with both "yes/no" and "true/false", currently waiting for results with "1/0".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That symptom is likely a scoping issue, and can be solved by first creating the variable before the first condition. Then when it is re-created inside, the value will be replaced and available later in the rule.
For example:
Also with this technique, you may be able to simplify the logic to only set the value when it differs from the default value of the variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
Creating the variable before the if/else statement fixed the issue. We just had another release and the workflow is now working as expected.
Thanks for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped!
Thanks for following up as this will help others reviewing this thread in the future confirm the behavior.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.