Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JSWCLOUD-22527

It's required to create any variable before branch to access a variable created inside branch after the branch execution ended

      Issue Summary

      Any variable outside branch (before) is required to access the value of any variable created inside a branch after the branch execution ended.

      Steps to Reproduce

      1. Create a variable inside the branch
      2. Access the value outside the branch. It's only accessible if any other variable was created before the branch even if it's not used.

      Expected Results

      Either no variable should be required before the branch, or it should be the same variable that requires to be created before the branch (global context)

      Actual Results

      If no variable is created before the branch then the variables created inside the branch context cannot be used outside the branch.

      Workaround

      create any variable before the branch

            [JSWCLOUD-22527] It's required to create any variable before branch to access a variable created inside branch after the branch execution ended

            I am not sure what you mean by "parentvalue" in this context. The problem here is that any variables created inside the branch (or editing a variable previously declared outside the branch) do not reflect those changes in the rest of the rule after the branch component, except for one special case.

            The one special case is if you declare any variable before the branch component, ONE branch execution will have its variable changes reflected in the rest of the rule. This branch is the first branch executed.

            There are a bunch of technical reasons for this edge case, but this is not behaviour we would want customers relying on, as it is not intended user experience. We are in the process of looking at alternatives to fix this in a non-invasive way.

            Cheers
            Sam

            Sam Harding added a comment - I am not sure what you mean by "parentvalue" in this context. The problem here is that any variables created inside the branch (or editing a variable previously declared outside the branch) do not reflect those changes in the rest of the rule after the branch component, except for one special case. The one special case is if you declare any variable before the branch component, ONE branch execution will have its variable changes reflected in the rest of the rule. This branch is the first branch executed. There are a bunch of technical reasons for this edge case, but this is not behaviour we would want customers relying on, as it is not intended user experience. We are in the process of looking at alternatives to fix this in a non-invasive way. Cheers Sam

            I think the problem was not understanded. "var" is not the same as "parentvalue". On the other hand, even declaring the variable before the branch, the value does not change inside the branch.

            David Arturo Cruz Salinas added a comment - I think the problem was not understanded. "var" is not the same as "parentvalue". On the other hand, even declaring the variable before the branch, the value does not change inside the branch.

            Hi there,

            This is expected behaviour, and is a result of how our rules are executed. A branch is essentially a separate, sub-rule which is run asynchronously from the rest of the rule. As such, it cannot affect the rest of the rule. Variables cannot be passed back from a branch execution. Your work around you have presented is the correct approach; if you want to use the variable in the root rule, then it must be declared there.

            Cheers

            Sam

            Sam Harding added a comment - Hi there, This is expected behaviour, and is a result of how our rules are executed. A branch is essentially a separate, sub-rule which is run asynchronously from the rest of the rule. As such, it cannot affect the rest of the rule. Variables cannot be passed back from a branch execution. Your work around you have presented is the correct approach; if you want to use the variable in the root rule, then it must be declared there. Cheers Sam

              Unassigned Unassigned
              4bd2fd3801db Jorge H
              Affected customers:
              0 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: