Uploaded image for project: 'Automation for Cloud'
  1. Automation for Cloud
  2. AUTO-1260

Variable created inside IF Block or Branch is not accessible outside of a block , if there is no variable created globally (after trigger) in Automation

    • Severity 3 - Minor

      Issue Summary

      When a variable is created only inside IF/ELSE Block or in a Branch then the variable is not accessible anywhere in Automation apart from the Branch.

      At the same time, if you create one Global Variable (after the trigger or before IF/ELSE block or branch) and then other variables created inside IF/ELSE Block or in a Branch will be accessible anywhere.

      Steps to Reproduce

      1. Create a Automation,
      2. Add If/Else Block or other Branch , create variable inside If/Else block
      3. Add Log action within If/Else block to Print Variable created in If/else block. It works fine.
      4. Now Add Log action outside If/Else block to Print Variable created in If/else block. It doesn't work.

      Expected Results

      Variables should be accessible in all places in the rule.

      Actual Results

      Variable is not accessible.

      Workaround

      1. Create Global Variable right after the trigger or before the IF/ELSE block or branch like below.
      2. Then all variables will be accessible.

       

            [AUTO-1260] Variable created inside IF Block or Branch is not accessible outside of a block , if there is no variable created globally (after trigger) in Automation

            Charlie Gavey made changes -
            Resolution New: Duplicate [ 3 ]
            Status Original: Gathering Impact [ 12072 ] New: Closed [ 6 ]

            Charlie Gavey added a comment - AUTO-154
            Charlie Gavey made changes -
            Link New: This issue duplicates AUTO-154 [ AUTO-154 ]
            Dan Cristian Rotaru made changes -
            Status Original: Needs Triage [ 10030 ] New: Gathering Impact [ 12072 ]

            Hi team, Dan here from Automation Platform,

            I was able to replicate the described behavior and log after the if-condition a variable created inside the if-condition (if there was another global variable created first). 

            Regarding variables behavior, we have to distinguish two use cases here:

            1. Inline branches: if-conditions and inline branches that are executed once-and-only-once (e.g. on Parent, on Current Issue, etc.) run in-line (synchronously). This a decision made a long time ago for optimisation purposes.
            2. Branches that are executed on more than one issue (e.g. JQL, linked issues, etc.) are run in parallel and asynchronously. There is no guarantee of when the branch will finish, until right up to the end of the rule and because of that whatever happens inside these branches (e.g. new variable creation) remains so, except for any issue updates, web requests, etc.

            In this original community post you can find more details: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Create-variable-New-component/ba-p/1448118 

            Had a discussion with our team and this seems indeed like a confusing behavior that should only be happening for inline-branches. Moving to gathering impact.

            Thank you,

            Dan

            Dan Cristian Rotaru added a comment - Hi team, Dan here from Automation Platform, I was able to replicate the described behavior and log after the if-condition a variable created inside the if-condition (if there was another global variable created first).  Regarding variables behavior, we have to distinguish two use cases here: Inline branches: if-conditions and inline branches that are executed once-and-only-once (e.g. on Parent, on Current Issue, etc.) run in-line (synchronously). This a decision made a long time ago for optimisation purposes. Branches that are executed on more than one issue (e.g. JQL, linked issues, etc.) are run in parallel and asynchronously. There is no guarantee of when the branch will finish, until right up to the end of the rule and because of that whatever happens inside these branches (e.g. new variable creation) remains so, except for any issue updates, web requests, etc. In this original community post you can find more details: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Create-variable-New-component/ba-p/1448118   Had a discussion with our team and this seems indeed like a confusing behavior that should only be happening for inline-branches. Moving to gathering impact. Thank you, Dan
            Arvind Kishore made changes -
            Link New: This issue is related to AUTO-154 [ AUTO-154 ]
            jhaloot made changes -
            Labels New: jsw-s13
            Arvind Kishore created issue -

              Unassigned Unassigned
              e8ddb9406228 Arvind Kishore
              Affected customers:
              3 This affects my team
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: