I have a multi-user picker field, and would you let me know how I can get the first user in this multi-user picker field by script runner? Then, I would set the value to assignee field automatically. Thanks!
A simple "get data from custom field" call will get a collection of users from a multi-user field, which you can then iterate over to get individual entries.
However, that collection is not sorted, so there's not going to be a clear definition of "first". What is your definition of "first" here?
Hi Nic, thanks for your replying. Suppose the collection of users is a list, say listA, so "first" means the first user which is input into this field, such as listA[0]. And would you show the code how to get the value of the multi-user field, and how to get the first item of the collection? Thanks for your help. I'm new to ScriptRunner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jira doesn't record that, it can't because of the nature of the field.
Imagine this sequence:
The important thing here is that the browser is not sending any data about the field to Jira until the create button is hit. At that point, the field contains "Alice and Bob", there's no data about the order they were chosen.
So, as the field has no data about the order people were added to it, you can't extract the"first" user by your definition.
You'll need to think of a different rule for who is "first"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.