Parsing username from single choice select list

Peter Pesta January 29, 2019

Hi all,

I need to solve an issue, where I 'd like to have a single choice select list custom field with values (user names and user ID's) where the chosen option would be parsed based on user name or ID, validated against user management from crowd/LDAP), and the result (user) would populate a single choice user picker custom field, which can be later used e.g. for a validation on a transition.

Use case: Employee picks an "approver" from a list of people (single choice select list). This option is parsed, validated and matched to an actual JIRA user. This parsed JIRA user (e.g. approver), is then copied into another custom field (single choice user picker).

There are three scenarios: 
1: Usage of an post function on any transition (or create screen) screen with the single choice custom field. 

2: Using a Listener for a issue field update, when the single choice select list changes the value, then the approver changes as well.

3: Scenario 1 and 2 combined. That the single choice custom field can be changed on edit screen, but can be used on a transition screen as well (based on demand of the management or project/process owner)

Idea behind this request: I don't want people to start typing any name in a user picker field, but I want them to have all the possible "approvers" visible, listed in one select list.


Has anyone of you experience with something like this? Anyone who could advice me if I have to use a listener or it can be done in any other way?

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Alvin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2019

Hi @Peter Pesta, you can do it on an easier way, use Single user-picker custom field , it is a custom field  by Jira itself. 

Peter Pesta January 30, 2019

Hi @Alvin. Thank you very much. 
The reason why I want to use the select list is, that I do not want users to start typing any name in the user picker field. They don't really need to know who can be set as "approver" and a select list gives them all the possible options right away. 

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2019

I would use a single user-picker field directly, not try to code.

In the more recent versions of Jira, you can limit the list to just the approvers by having them in group or a role in the project.  Create the field as usual, then go to configure it and look at the context - you can set "rules about who to show in the list" in there.

Peter Pesta January 30, 2019

Hi @Nic Brough -Adaptavist-. Thank you very much. 
The reason why I want to use the select list is, that I do not want users to start typing any name in the user picker field. They don't really need to know who can be set as "approver" and a select list gives them all the possible options right away. 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 30, 2019

If they don't need to know who can be set as an approver, then I'd skip the field completely and write a short script that sets it for them.

Peter Pesta January 30, 2019

They don't need to know who can be set (like if it's person A, B, C or D), but they have to choose one from the list. 
Sometimes people change their positions and newcomers doesn't necessarily know all the "approvers". It is easier to choose one name from a list, than to look for all possible options and then choosing one. Since the "responsible for the approval" can be just one from many.  

TAGS
AUG Leaders

Atlassian Community Events