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

Automation: Ability to use variable outside of a block - variable is not updated on main branch if created inside an if/else or branch block

    • 0
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      If there is a requirement that involves creating a variable inside a branch or if/else block, the same variable will not hold the value when used outside of the block.

      For example, suppose a rule is triggered when an issue is created. For all the issues with a similar issue description as the trigger issue, a variable is created containing all issue keys. When the same variable is printed outside the branch, it returns no values:

      Expected behaviour:

      It should return the same value as the variable is used in the same rule.

      Current behaviour:

      The variable is not accessible - if we try to access the variable, it will return an empty value.

            [AUTO-154] Automation: Ability to use variable outside of a block - variable is not updated on main branch if created inside an if/else or branch block

            Enida made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 1016906 ]
            Makarand Gomashe made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 999878 ]
            SET Analytics Bot made changes -
            UIS Original: 1 New: 0

            Thank you, 43071b44dfdb .  That could be it.  In some of my child branches, I'm making API requests out to other web services.  Those branches seem to lead to the issue I was describing.

            Because of this issue, we've decided to stop relying so much on Jira Automations and instead have started moving some of our workloads to Azure Logic Apps, which do seem to honor the flow and allow us more flexibility and do not have this same specific issue about variables being updated in if/else branches.

            Nathan Given added a comment - Thank you, 43071b44dfdb .  That could be it.  In some of my child branches, I'm making API requests out to other web services.  Those branches seem to lead to the issue I was describing. Because of this issue, we've decided to stop relying so much on Jira Automations and instead have started moving some of our workloads to Azure Logic Apps, which do seem to honor the flow and allow us more flexibility and do not have this same specific issue about variables being updated in if/else branches.

            f0fcd7749d49 by the given description, it seems like you're having problem with block execution order.

            I have experienced following my self:

             

            • A block
            • B block
              • C block (IF block or Branch)
            • D block
            • E block
            • ...

             

            Execution order goes something like this:

            1. A (until done)
            2. B (until done)
            3. C and D (until done)
            4. E...

             

            try adding "delay" block at position D (after your IF block) and test the result of a variable in E block.

            See if that helps  

            Benjamin Črnjak added a comment - f0fcd7749d49 by the given description, it seems like you're having problem with block execution order. I have experienced following my self:   A block B block C block (IF block or Branch) D block E block ...   Execution order goes something like this: A (until done) B (until done) C and D (until done) E...   try adding "delay" block at position D (after your IF block) and test the result of a variable in E block. See if that helps  

            Nathan Given added a comment - - edited

            Ran into this issue today.

            We can create a variable outside of an IF block

            We can edit that variable outside of the IF block (by "creating" it again with a new value)

            We can use the variable inside the IF block

            But if we EDIT the variable inside the IF block, then the EDIT is only visible inside the IF block (I just spent a few hours testing this. It appears that sometimes the variable is edited fine, and other times it isn't. Haven't figured this out yet).

            And unfortunately, we need the ability to check a condition, and if true, reliably edit the variable for use back in the main line of the flow.

            Nathan Given added a comment - - edited Ran into this issue today. We can create a variable outside of an IF block We can edit that variable outside of the IF block (by "creating" it again with a new value) We can use the variable inside the IF block But if we EDIT the variable inside the IF block, then the EDIT is only visible inside the IF block (I just spent a few hours testing this. It appears that sometimes the variable is edited fine, and other times it isn't. Haven't figured this out yet). And unfortunately, we need the ability to check a condition, and if true, reliably edit the variable for use back in the main line of the flow.
            Charlie Gavey made changes -
            Link New: This issue is duplicated by AUTO-1260 [ AUTO-1260 ]

            Within Service Management it is quite common to leverage both a reporter and a requested on behalf of field for tickets. In those cases, when we need to perform lookups on the person the ticket is 'for' we write an if/else block that checks on behalf of if they exist and checks reporter otherwise. We then need to use the output of those lookups, captured as variables, in future actions outside the block. It would be very helpful to have access to variables throughout the entire automation scope.

            Megan Hartz added a comment - Within Service Management it is quite common to leverage both a reporter and a requested on behalf of field for tickets. In those cases, when we need to perform lookups on the person the ticket is 'for' we write an if/else block that checks on behalf of if they exist and checks reporter otherwise. We then need to use the output of those lookups, captured as variables, in future actions outside the block. It would be very helpful to have access to variables throughout the entire automation scope.
            Makarand Gomashe made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 928289 ]
            Enida made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 916640 ]

              89403358cf11 Charlie Gavey
              3033da771e98 Ashutosh Sharma
              Votes:
              114 Vote for this issue
              Watchers:
              70 Start watching this issue

                Created:
                Updated: