I am setting up a very simple post function using the JMWE extension to set the assignee based on a value in my custom field.
I have confirmed that my conditional logic works, however, when it tries to set the assignee it can not find the user.
I have tried different syntax (First name last name, email address, "@First name last name") for assignee and nothing seems to work.
The value(s) of field Assignee of the current issue will be set to Anna Robinson (replacing existing values). Send notification.
Run as add-on user.
Run this post-function conditionally:
issue.fields["Product Area Test"].value == "Admin"
The error I get is:
Incorrect request: {"assignee":"User 'Anna Robinson' does not exist."}
|
Is there specific syntax that I should be using to get this to work?
The final resolution was to use the username value which can only be found inside the URL on the admin edit user page /admin/users/view?username=X.
Hi @Anna Robinson,
you can set the assignee like this:
import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.getUserManager().getUserByKey("username")
issue.setFieldValue("Assignee", user)
I would not use the first, last or display name in the script, use the shortname, the name the user is using for login.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry - I am pretty new to the backend configuration of JIRA, but this is the screen that I am using to configure the JMWE.
The assignee field is just taking a value inside a field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anna,
you need to specify the username of the user. The username is only visible on the user's Profile page.
This will change early next year, when Atlassian will be removing usernames (among other things), and you will need to specify an accountId instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, that worked.
Wow, that was not very intuitive at all.
For anyone else struggling with this, the only place you can see the username is actually inside the URL on the admin edit user page /admin/users/view?username=X.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It used to be displayed on the User management page but Atlassian removed it recently, in preparation for the GDPR changes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Thomas Schlegel I wonder where you can script the workflow function could you tell me where I can find that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.