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

String manipulation functions (such as concat/replace) do not work properly with variables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 9.0.0, 9.0.1, 9.0.2, 9.0.3
    • Severity 3 - Minor
    • 0

      Issue Summary

      String manipulation functions (such as concat/replace) do not work properly when using a variable created using the Create Variable action.

      Steps to replicate

      1. Install Jira on any version from 8.20.0
      2. Install Automation For Jira (A4J) on top of Jira, with any A4J version from 9.0.0
      3. Create 2 Text Fields, let's call them
        • "Text Field"
        • "Text Field 2"
      4. Create a new automation rule with the configuration below:
        • Trigger: "Manually Triggered:
        • Add a 1st Action: "Create variable", with the parameters below:
          • Variable Name: variableContainingTextField
          • Smart Value:
            {{issue.Text Field 2}}
            
        • Add a 2nd Action: "Log action", with the message below:
          {{issue.Text Field.concat(variableContainingTextField)}}
          
        • Add a 3rd Action: "Log action", with the message below:
          {{issue.Text Field.concat(issue.Text Field 2)}}
          

      5. Create a new Jira issue, and add some text the 2 fields listed below, for example:
        • Set Test Field to "Hello"
        • Set Test Field 2 to "World"
      6. Trigger the automation rule from this issue via the More dropdown menu from the View Issue screen

      Expected results

      Both "Log Action" components should return the same result, which should be: "HelloWorld".

      Actual results

      The log action which is using the concat function with the variable created using the Create Variable action is returning an empty value.

      The log action which is using the custom field smart value in the contact function is working as expected

      Workaround

      In the concat function (or any other string manipulation function), add .trim() to force the variable to be treated as a String:

      {{issue.Text Field.concat(variableContainingTextField.trim())}} 

        1. IssueExample.png
          48 kB
          Julien Rey
        2. AutomationRuleAuditLogs.png
          47 kB
          Julien Rey
        3. AutomationRule.png
          156 kB
          Julien Rey

              nwroblewska Natalia Wroblewska
              jrey Julien Rey (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: