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

Comparing values in the response of a webhook request against a custom field using string functions do not work

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 8.0.3, 8.0.4
    • Smart-values
    • Minor
    • 0

      Issue Summary

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Create an empty Software Project -> call it Rugby
      2. Create 2 custom fields
        1. Text Field (single line) -> call it potato
        2. Select List (single choice) -> call it cheese
      3. Add these custom fields to the software project
      4. Create an automation rule in the software project
        1. Create a webhook to retrieve all projects
          1. GET http://<jira base url>/rest/api/2/project
        2. Add the below log actions:
          1. Webhook items: {{#webhookResponse.body}} id {{id}} name {{name}}, {{/}}
            
          2. cheese -> field name dot value: "{{cheese.value}}", issue dot field name dot value: "{{issue.cheese.value}}", issue dot id dot value: "{{issue.customfield_11400.value}}"
            
            • replace customfield_11400 with your own custom field
            • this is just printing the values for the first custom field (cheese) which is of type Select List (single choice)
            • next up are the log actions for this custom field
          3. Webhook contains field name dot value: {{#webhookResponse.body}} {{#if(name.indexOf(cheese.value).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
            
          4. Webhook contains issue dot field name dot value: {{#webhookResponse.body}} {{#if(name.indexOf(issue.cheese.value).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
            
          5. Webhook contains issue dot field id dot value: {{#webhookResponse.body}} {{#if(name.indexOf(issue.customfield_11400.value).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
            
            • replace customfield_11400 with your own custom field
          6. potato -> field name: "{{potato}}", issue dot field name: "{{issue.potato}}", issue dot id: "{{issue.customfield_11100}}"
            
            • replace customfield_11100 with your own custom field
            • this is the second custom field which is of type Text Field (single line)
            • next up are the log actions for this custom field
          7. Webhook contains field name: {{#webhookResponse.body}} {{#if(name.indexOf(potato).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
            
          8. Webhook contains issue dot field name: {{#webhookResponse.body}} {{#if(name.indexOf(issue.potato).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
            
          9. Webhook contains potato issue dot field id: {{#webhookResponse.body}} {{#if(name.indexOf(issue.customfield_11100).gt(-1))}}  id {{id}} name {{name}} {{/}} {{/}}
            
            • replace customfield_11100 with your own custom field
          10. Webhook contains "rugby": {{#webhookResponse.body}} {{#if(equals(name, "rugby"))}} id {{id}} name {{name}} {{/}} {{/}}
            
          11. Webhook contains "rugby": {{#webhookResponse.body}} {{#if(name.indexOf("rugby").gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
            
            • And the last 2 log actions that work check the text string rugby directly

      Then create an issue and populate the custom fields with a partial the name of the project and it should trigger the above automation rule and you should see the problem in the log output as per the screenshot below.

      Expected Results

      We expect to see results for projects that match the values of my custom fields

      Actual Results

      No projects are logs as nothing matches the custom fields, this is not because of the values but because the functions do not work with custom fields:

      The same happens for star values, if you create a smart value in automation you will have the same result as described with custom fields.
       

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

            [JIRAAUTOSERVER-543] Comparing values in the response of a webhook request against a custom field using string functions do not work

            There are no comments yet on this issue.

              4e432536cf93 Karol Skwierawski
              5cabfa73260d Jarrod Price (Inactive)
              Affected customers:
              1 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated: