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

Automation fails when it has two fields with the same name/type, showing the error "Found multiple fields with the same name and type:" and Additional fields contains invalid field(s) in 'update' or 'fields' section. <field_name>"

    • Severity 3 - Minor
    • 0

      Issue Summary

      Automation fails when has two fields with the same name/type, showing the error "Found multiple fields with the same name and type:"

      In case rule has custom filed of type cascading and another custom field with same name exist then rule fails with below error: 
      "Additional fields contains invalid field(s) in 'update' or 'fields' section.
      <field_name>"

      Steps to Reproduce

      1. Create a new number custom field in a Next-Gen project
      2. Create a rule to copy the value from this field. Below, follows an example.
      3. Set the rule scope for the Next-Gen project.
      4. Under <instance>.atlassian.net/secure/admin/ViewCustomFields.jspa create a new number custom field with the same name.
      5. Associated the "number" custom field to a classic project.
      • Reload the rule, and then run the rule.
      • Then will appear the error "Found multiple fields with the same name and type:"

      Expected Results

      When we set the scope of the rule to a Next-Gen project, it should not consider a classic custom field. 

      Actual Results

      Even the rule restricts to the Next-Gen project, appear the error "Found multiple fields with the same name and type:". The rule is considering a field with the same name and type, causing this error. 

      Workaround

      We can change the field name to a different one, and then the rule will run without error.
       

        1. image-2020-12-10-09-36-14-114.png
          64 kB
          Cristiano
        2. image-2020-12-10-09-36-27-134.png
          64 kB
          Cristiano
        3. image-2020-12-10-09-36-39-080.png
          11 kB
          Cristiano
        4. image-2020-12-10-09-36-57-304.png
          7 kB
          Cristiano
        5. screenshot-1.png
          161 kB
          Cristiano

            [AUTO-161] Automation fails when it has two fields with the same name/type, showing the error "Found multiple fields with the same name and type:" and Additional fields contains invalid field(s) in 'update' or 'fields' section. <field_name>"

            Kyle Stevenson added a comment - - edited

            Hi Marcelo,

            The documentation you linked describes setting the value on a variety of field types.

            When a field has multiple options you can address them by ID or Value.

            See these examples in the documentation:

            • Radio button custom field
            • Cascading select custom field
            • Multi-select custom field
            • Single-select custom field

            Edit:

            In many field types you do not need to use that structure.
            Note the custom field type from Jira and refer to it in the documentation linked.

            As an example, I have a 'Select List (single choice)' field.
            The documentation states:

            Single-select custom field
            Select a single value from a defined list of values. You can address them by value or id.

            {{"customfield_11449" :
            Unknown macro: { "value"}
            }}
            or
            {{"customfield_11449" :
            Unknown macro: { "id"}
            }}

            In that case I would use this format:

            {
              "fields": {
                "customfield_12345": {
                  "value": "My Value"
                }
              }
            }
            

            The issue with adressing the option by Value is if it is changed, the automation will then fail.
            If the value is very unlikely to change, or you are managing the custom field and automation, this might be acceptable.

            Another example would be a 'Text Field (single line)' field.

            Text custom field

            A single line of text.
            "customfield_11450": "a single line of text"

            {
              "fields": {
                "customfield_12345": "My Value"
              }
            }

             

            Kyle Stevenson added a comment - - edited Hi Marcelo, The documentation you linked describes setting the value on a variety of field types. When a field has multiple options you can address them by ID or Value. See these examples in the documentation: Radio button custom field Cascading select custom field Multi-select custom field Single-select custom field Edit: In many field types you do not need to use that structure. Note the custom field type from Jira and refer to it in the documentation linked. As an example, I have a 'Select List (single choice)' field. The documentation states: Single-select custom field Select a single value from a defined list of values. You can address them by value or id. {{"customfield_11449" : Unknown macro: { "value"} }} or {{"customfield_11449" : Unknown macro: { "id"} }} In that case I would use this format: {   "fields" : {     "customfield_12345" : {       "value" : "My Value"     }   } } The issue with adressing the option by Value is if it is changed, the automation will then fail. If the value is very unlikely to change, or you are managing the custom field and automation, this might be acceptable. Another example would be a 'Text Field (single line)' field. Text custom field A single line of text. "customfield_11450": "a single line of text" { "fields" : { "customfield_12345" : "My Value" } }  

            Marcelo Correa added a comment - - edited

            The suggestion from Kyle took me in the right direction but wasn't working for me.

            In the end, had to remove the value field, so something like this:

            {
              "fields":
            {     "customfield_12345": "A value"
              }
            }
            

            This documentation helped to figure out that the value field was not needed: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

            PS: The suggestion from Yuri wasn't working at all - would get an error when trying to import the Json file.

            Marcelo Correa added a comment - - edited The suggestion from Kyle took me in the right direction but wasn't working for me. In the end, had to remove the value field, so something like this: {   "fields" : {     "customfield_12345" : "A value"   } } This documentation helped to figure out that the value field was not needed: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/ PS: The suggestion from Yuri wasn't working at all - would get an error when trying to import the Json file.

            {
            "fields": {
            "customfield_12345":

            { "value": "A value" }

            }
            }

            Does not work for my case. Says "field value must be a string". I submitted "2022-02-22" (the same value it was in REST representation of the issue)

            Sergei Gridnevskii added a comment - { "fields": { "customfield_12345": { "value": "A value" } } } Does not work for my case. Says "field value must be a string". I submitted "2022-02-22" (the same value it was in REST representation of the issue)

            This has affected us as well and after trying workarounds (exporting the automation to JSON, update the ID and importing) that didn't worked out, also using the official Atlassian documentation syntax with [customfieldname].ID didn't work, so I've tried to use the syntax issue.customfield_id to check the value of the custom field and Jira could validate the value even when there are two custom fields with the same type and name. 
            Maybe this can help somebody out there fighting the automation. 

            peter.pesta added a comment - This has affected us as well and after trying workarounds (exporting the automation to JSON, update the ID and importing) that didn't worked out, also using the official Atlassian documentation syntax with [customfieldname] .ID didn't work, so I've tried to use the syntax  issue.customfield_id to check the value of the custom field and Jira could validate the value even when there are two custom fields with the same type and name.  Maybe this can help somebody out there fighting the automation. 

            This is affecting us as well.  I have a business project with five fields (2 check box fields and 3 drop downs).  I've created the same fields in my software project - same name and types.  I expected the automation to be able to 1) understand the names are the same and copy the fields or 2) allow me to manually associate them.  An example for the second solution is Epic Name.  I can copy that from Summary.  i.e. the Business project summary = the software project's epic name.  Why can't I do that for all fields?

            Abby Kiesling added a comment - This is affecting us as well.  I have a business project with five fields (2 check box fields and 3 drop downs).  I've created the same fields in my software project - same name and types.  I expected the automation to be able to 1) understand the names are the same and copy the fields or 2) allow me to manually associate them.  An example for the second solution is Epic Name.  I can copy that from Summary.  i.e. the Business project summary = the software project's epic name.  Why can't I do that for all fields?

            Juan you can use the suggestion from Yuri above regarding exporting the rule and updating the field to the ID.

            Another option is to update using the 'Additional fields' section instead:

            {
              "fields": {
                "customfield_12345": {
                  "value": "A value"
                }
              }
            }
             

            I went with the second option and it works as expected.

            Kyle Stevenson added a comment - Juan you can use the suggestion from Yuri above regarding exporting the rule and updating the field to the ID. Another option is to update using the 'Additional fields' section instead: {   "fields" : {     "customfield_12345" : {       "value" : "A value"     }   } } I went with the second option and it works as expected.

            Juan Sugg added a comment - - edited

            In my case, automation doesn't recognize the project's custom fields at all - having a unique name doesn't solve the problem

            Juan Sugg added a comment - - edited In my case, automation doesn't recognize the project's custom fields at all - having a unique name doesn't solve the problem

            This issue is having a significant impact on our organizations use of Automation - I believe the severity should be significantly higher than "minor".

             

            Matt Harford added a comment - This issue is having a significant impact on our organizations use of Automation - I believe the severity should be significantly higher than "minor".  

            mpoutre-x added a comment -

            Adding to what Kyle said above, even if this issue at it's core can't be fixed, I would expect that limiting the context of the item would suffice as long as the automation rule is also scoped to a specific set of projects

            mpoutre-x added a comment - Adding to what Kyle said above, even if this issue at it's core can't be fixed, I would expect that limiting the context of the item would suffice as long as the automation rule is also scoped to a specific set of projects

            Even limiting the context of the field to a project does not fix the issue.

             

             

            Kyle Stevenson added a comment - Even limiting the context of the field to a project does not fix the issue.    

              9df7f128cb98 Eshaa Sood
              cfontana@atlassian.com Cristiano
              Affected customers:
              99 This affects my team
              Watchers:
              117 Start watching this issue

                Created:
                Updated: