Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-2189

Assignee is not set in behaviours if user picker returns multiple results and the required user is not the first one

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Fixed
    • 4.3.18
    • 5.0.0, 5.0.1
    • None
    • None
    • Sprint 28 - Ends Apr 19, Sprint 29 - Ends 10 May
    • 0.7

    Description

      The assignee set in an initialiser using the following script is not set if the user picker returns multiple results and the required user is not the first one.

      To reproduce this login as user with username "admin" and create a user with display name "Other admin". Setup a behaviour with an initialiser containing the following code:

      import com.atlassian.jira.component.ComponentAccessor
      import com.onresolve.jira.groovy.user.FieldBehaviours
      import groovy.transform.BaseScript
      
      import static com.atlassian.jira.issue.IssueFieldConstants.ASSIGNEE
      
      @BaseScript FieldBehaviours fieldBehaviours
      
      def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
      
      getFieldById(ASSIGNEE).setFormValue(currentUser.name)
      

      The user picker call to /rest/api/2/user/picker will return more than one result and the required user will not be the first one in the list.

      We need to do an exact search which the user picker endpoint does not provide. Excluding certain names may work but it's probably best to have our own endpoint to return an exact match on username.

      Attachments

        Issue Links

          Activity

            People

              tbatagiannis Thanos Batagiannis
              amarkham Adam Markham
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: