Uploaded image for project: 'Automation for Jira Server'
  1. Automation for Jira Server
  2. JIRAAUTOSERVER-481

When using OR syntax in FixVersion field, it doesn't return correct results

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Low Low
    • None
    • 7.4.2
    • Smart-values
    • None
    • Severity 3 - Minor

      Issue Summary

      When using the OR smart values on the Fix Version field, it doesn't return the right results.

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      1. Create a new issue and add the Version 1.0 value to the Fix Version field.
      2. Create a new Automation rule with "Manually triggered" and add the "Edit Issue" on the action.
        • Choose to update the Description field with the syntax below.
      3. Paste the smart syntax in the rule actions:
        * issue.fixVersions.name.equals("Version 1.0"): {{issue.fixVersions.name.equals("Version 1.0")}}
        * or(issue.fixVersions.name.equals("Version 1.0"), false):  {{or(issue.fixVersions.name.equals("Version 1.0"), false)}}
        * or(issue.fixVersions.first.name.equals("Version 1.0"), false):  {{or(issue.fixVersions.first.name.equals("Version 1.0"), false)}}
        
      1. Publish the changes.
      2. The results we get is this:

      Expected Results

      Based on the OR logic:

      or(issue.fixVersions.name.equals("Version 1.0"), false)
      

      When comparing true or false, we should get true instead of false.

      Actual Results

      The results returned false instead comparing true OR false logic.

      Workaround

      Add a .first syntax:

      or(issue.fixVersions.first.name.equals("Version 1.0"), false)
      

            [JIRAAUTOSERVER-481] When using OR syntax in FixVersion field, it doesn't return correct results

            I see now. I was thinking for some reason that this single fix version will be casted to string and will be compared as a string.

            Andrey Bushkevich added a comment - I see now. I was thinking for some reason that this single fix version will be casted to string and will be compared as a string.

            f5326150b242 ,

            displayed result of 

            {{issue.fixVersions.name.equals("Version 1.0")}}

            is iteration over all names in the collection, that's why for one element collection the displayed text looks like single result.

            To properly observe difference please check following smart value:

            This is original one:
            * issue.fixVersions.name.equals("v1.0.0"): {{issue.fixVersions.name.equals("v1.0.0")}}
            * or(issue.fixVersions.name.equals("v1.0.0"), false):  {{or(issue.fixVersions.name.equals("v1.0.0"), false)}}
            * or(issue.fixVersions.first.name.equals("v1.0.0"), false):  {{or(issue.fixVersions.first.name.equals("v1.0.0"), false)}}
            
            Iterating through fixVersions
            {{#issue.fixVersions}}
            * current version name: *{{name}}*
            ** name.equals("v1.0.0"): {{name.equals("v1.0.0")}}
            ** or(name.equals("v1.0.0"), false):{{or(name.equals("v1.0.0"), false)}}  
            {{/}}
             

            For the Issue where just single fix version is set the result is:

            In case of the issue where multiple fix versions are set, the result is

            Regards

            Daniel Ramotowski

            Daniel Ramotowski added a comment - f5326150b242 , displayed result of  {{issue.fixVersions.name.equals( "Version 1.0" )}} is iteration over all names in the collection, that's why for one element collection the displayed text looks like single result. To properly observe difference please check following smart value: This is original one: * issue.fixVersions.name.equals( "v1.0.0" ): {{issue.fixVersions.name.equals( "v1.0.0" )}} * or(issue.fixVersions.name.equals( "v1.0.0" ), false ):  {{or(issue.fixVersions.name.equals( "v1.0.0" ), false )}} * or(issue.fixVersions.first.name.equals( "v1.0.0" ), false ):  {{or(issue.fixVersions.first.name.equals( "v1.0.0" ), false )}} Iterating through fixVersions {{#issue.fixVersions}} * current version name: *{{name}}* ** name.equals( "v1.0.0" ): {{name.equals( "v1.0.0" )}} ** or(name.equals( "v1.0.0" ), false ):{{or(name.equals( "v1.0.0" ), false )}}   {{/}} For the Issue where just single fix version is set the result is: In case of the issue where multiple fix versions are set, the result is Regards Daniel Ramotowski
            Daniel Ramotowski made changes -
            Attachment New: result_multiple_versions.png [ 422919 ]
            Daniel Ramotowski made changes -
            Attachment New: result_1_version_set.png [ 422918 ]
            Daniel Ramotowski made changes -
            Attachment Original: result_multiple_versions.png [ 422914 ]
            Daniel Ramotowski made changes -
            Attachment Original: result_1_version_set.png [ 422913 ]
            Daniel Ramotowski made changes -
            Attachment New: result_multiple_versions.png [ 422914 ]
            Daniel Ramotowski made changes -
            Attachment New: result_1_version_set.png [ 422913 ]

            Wait a second.

            In bug report it is stated that

            issue.fixVersions.name.equals("Version 1.0")

            returns true, not false, as you say.

            So,

            or(issue.fixVersions.name.equals("Version 1.0"), false) 

            should return true.

            Andrey Bushkevich added a comment - Wait a second. In bug report it is stated that issue.fixVersions.name.equals( "Version 1.0" ) returns true, not false, as you say. So, or(issue.fixVersions.name.equals( "Version 1.0" ), false ) should return true.
            Daniel Ramotowski made changes -
            Resolution New: Not a bug [ 12 ]
            Status Original: Needs Triage [ 10030 ] New: Closed [ 6 ]

              dramotowski Daniel Ramotowski
              ckimloong John Chin
              Affected customers:
              2 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: