Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-36811

Cannot update JIRA custom field through jira-ext plugin

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • jira-ext-plugin
    • None

      I'm using the jira-ext plugin for jenkins, and try to update custom fields (in JIRA) of type Label and User Picker (single user) as part of my build. The update fails on the Label update stating:

      net.rcarz.jiraclient.JiraException: Field expects an Iterable value
      

      And on the User Picker, error:

      net.rcarz.jiraclient.RestException: 400 Bad Request: {"errorMessages":[],"errors":{"customfield_10100":"data was not an object"}}
      

      The configuration I use to update both is attached as a screenshot.

      What is the correct format to update such custom fields through this plugin? I tried matching the JIRA REST API documentation but probably didn't get that exactly.

          [JENKINS-36811] Cannot update JIRA custom field through jira-ext plugin

          Dan Alvizu added a comment -

          Is the field you are updating a multi-select field? If so I don't think that's supported yet in jira-ext plugin.

          There's a way to select it in the svc but this is not exposed in the UI, it will need to be implemented:

          https://github.com/jenkinsci/jira-ext-plugin/commit/5169f766c3300a37832f6c3db63d2f4fc1069602

          Dan Alvizu added a comment - Is the field you are updating a multi-select field? If so I don't think that's supported yet in jira-ext plugin. There's a way to select it in the svc but this is not exposed in the UI, it will need to be implemented: https://github.com/jenkinsci/jira-ext-plugin/commit/5169f766c3300a37832f6c3db63d2f4fc1069602

          Oren Schor added a comment - - edited

          dalvizu There are 2 fields I'm trying to update:
          1. Label field (which can contain more than one value)
          2. User Picker (single user) field which can contain only 1 value.

          Is the update of these 2 fields supported?

          Oren Schor added a comment - - edited dalvizu There are 2 fields I'm trying to update: 1. Label field (which can contain more than one value) 2. User Picker (single user) field which can contain only 1 value. Is the update of these 2 fields supported?

          Dan Alvizu added a comment -

          "Update a field" only works for types which the JIRA API accepts as a plain old JSON String, the user-picker sounds like a select field which doesn't qualify so no sadly it's not supported.

          Label is a special case which is supported as a JIRA operation available to add ("Add a Label"):

          https://github.com/jenkinsci/jira-ext-plugin/blob/master/src/main/java/org/jenkinsci/plugins/jiraext/view/AddLabel.java

          Dan Alvizu added a comment - "Update a field" only works for types which the JIRA API accepts as a plain old JSON String, the user-picker sounds like a select field which doesn't qualify so no sadly it's not supported. Label is a special case which is supported as a JIRA operation available to add ("Add a Label"): https://github.com/jenkinsci/jira-ext-plugin/blob/master/src/main/java/org/jenkinsci/plugins/jiraext/view/AddLabel.java

          Oren Schor added a comment -

          Is Label supported also for a custom field? because I don't want to add a label but rather update a custom field ("Fixed in Build") which is of type Label.

          Oren Schor added a comment - Is Label supported also for a custom field? because I don't want to add a label but rather update a custom field ("Fixed in Build") which is of type Label.

          Dan Alvizu added a comment -

          Ah, gotcha, no that's not supported

          Dan Alvizu added a comment - Ah, gotcha, no that's not supported

          Oren Schor added a comment -

          Thanks -
          1. Is there a list of the custom field types that ARE supported?
          2. What do I need to implement in order to support update of User Picker customer field and Label custom field?

          Oren Schor added a comment - Thanks - 1. Is there a list of the custom field types that ARE supported? 2. What do I need to implement in order to support update of User Picker customer field and Label custom field?

          Dan Alvizu added a comment -

          > 1. Is there a list of the custom field types that ARE supported?

          So far the only type that is supported is one that accepts just a String, but I don't have any way of translating that to JIRA types – such a list would be immensely helpful, but I can't find one.

          > 2. What do I need to implement in order to support update of User Picker customer field and Label custom field?

          You'd need to create a child of `JiraOperationExtension` much like `UpdateField` does – https://github.com/jenkinsci/jira-ext-plugin/blob/master/src/main/java/org/jenkinsci/plugins/jiraext/view/UpdateField.java – to accept your type of value.

          There is some support in the service layer to update a JIRA issue differently - it supports multi-select:

          https://github.com/jenkinsci/jira-ext-plugin/commit/5169f766c3300a37832f6c3db63d2f4fc1069602#diff-58571f6471a1cc5206d122c9a2632334R125

          Depending on what your field accepts, you might be able to use this, or might have to extend the service layer more to accept the other type.

          Dan Alvizu added a comment - > 1. Is there a list of the custom field types that ARE supported? So far the only type that is supported is one that accepts just a String, but I don't have any way of translating that to JIRA types – such a list would be immensely helpful, but I can't find one. > 2. What do I need to implement in order to support update of User Picker customer field and Label custom field? You'd need to create a child of `JiraOperationExtension` much like `UpdateField` does – https://github.com/jenkinsci/jira-ext-plugin/blob/master/src/main/java/org/jenkinsci/plugins/jiraext/view/UpdateField.java – to accept your type of value. There is some support in the service layer to update a JIRA issue differently - it supports multi-select: https://github.com/jenkinsci/jira-ext-plugin/commit/5169f766c3300a37832f6c3db63d2f4fc1069602#diff-58571f6471a1cc5206d122c9a2632334R125 Depending on what your field accepts, you might be able to use this, or might have to extend the service layer more to accept the other type.

          anil chauhan added a comment -

          I am trying to update a field which requires numeric value and getting an error as shown below. 
          ChangeLogSet class: class hudson.plugins.git.GitChangeSetList
          Operation: Update a Field
          Error updating ticket, continuing
          net.rcarz.jiraclient.JiraException: Field expects a Numeric value
          at net.rcarz.jiraclient.Field.toJson(Field.java:611)
          at net.rcarz.jiraclient.Issue$FluentUpdate.execute(Issue.java:171)
          Any update on when will it support Numeric updates. 

          anil chauhan added a comment - I am trying to update a field which requires numeric value and getting an error as shown below.  ChangeLogSet class: class hudson.plugins.git.GitChangeSetList Operation: Update a Field Error updating ticket, continuing net.rcarz.jiraclient.JiraException: Field expects a Numeric value at net.rcarz.jiraclient.Field.toJson(Field.java:611) at net.rcarz.jiraclient.Issue$FluentUpdate.execute(Issue.java:171) Any update on when will it support Numeric updates. 

          Dan Alvizu added a comment -

          Pull requests accepted - I am not planning to implement this 

          Dan Alvizu added a comment - Pull requests accepted - I am not planning to implement this 

            dalvizu Dan Alvizu
            oren Oren Schor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: