I have an automation that I'm using form data to drive an automation:
I've tried to equivalent approaches, but get different results and I'm not sure why.
LogicTests
Case 1 - Variable
RedAdv = {{issue.forms.717a0542-5b22-4ed3-926e-b541c9eb5fd7.RegAdv.label.get(0)}}
{{if(equals(RegAdv,"Yes"),issue.forms.717a0542-5b22-4ed3-926e-b541c9eb5fd7.RegAmount,0)}}
It returns the value expected
Case 2 - Smart Value
{{if(equals(issue.forms.717a0542-5b22-4ed3-926e-b541c9eb5fd7.RegAdv.label.get(0),"Yes"),issue.forms.717a0542-5b22-4ed3-926e-b541c9eb5fd7.RegAmount,0)}}
It fails and returns 0
{{RegAdv}} and {{issue.forms.717a0542-5b22-4ed3-926e-b541c9eb5fd7.RegAdv.label.get(0)}} return the same value so the context seems the same.
Any idea why it only works with a variable and not a smart value?
First thing, I am just another Jira customer and have no internal knowledge of the automation engine's implementation. My suggestions are based on my experience and observations using rules. With that out the way...
Some data in rules is usually available when the rule starts (e.g., fields in a trigger issue) while other data is looked up just-in-time to improve rule performance (e.g., sub-tasks, form data, assets, third-party addon custom fields, etc.) This behavior can create side-effects / problems in rules where all of the needed data is not ready fast enough to do what is needed; that is, a racetrack error happens.
When your rule stores the form data in the created variable, that looks up the data to complete the expression before the next rule step happens.
But without the variable and inside the conditional expression, it may not be looked up fast enough before the condition's equals() function completes.
There is another, less likely, possible cause: perhaps form fields do not work inside the equals() logical condition function. Some smart values do not work with some functions, and there is limited documentation to explain when these situations occur.
Please note my "usually available" from earlier. Even standard issue fields may have this problem with some rule triggers. An example for Jira Cloud is the Issue Created trigger, where the rule can start before all issue data is "ready", potentially leading to errors and other weird behaviors. The mitigation for that symptom is to always add the Re-fetch Issue action immediately after the Issue Created trigger, slowing the rule a bit and reloading the data before proceeding.
Kind regards,
Bill
Thanks Bill.
I had a similar thought on timing, seen a number of cases where similar things happen.
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.