[HELP] How to set Assignee value through Javascript in JIRA Create Issue page?

From JIRA Create Issue Page, I want to set the Assignee value through Javascript
Such as:
$('#assignee-field').val('A_Name')

But no luck, it cannot work.
Do you have any idea on how to trigger the value to be set for Assignee field

Thank anyone for your time and energy on this problem.

Thanks,
Yoyo

I expect that assignee location is the similar for reporter picker.
here is my solution:

let reporterInput = document.querySelector('#reporter-field')

if (reporterInput) {
      AJS.$("#reporter-field").val(username);
     AJS.$("#reporter").find(":selected").data("descriptor").model()[0].value = username;
}                

Just change “reporter” to “assignee”

Hi @belokurbohdan

Thank you very much

I saw this solution before, it does not work as below:
for the code and result
image

Thanks,
Yoyo

username variable is example for this case. You should insert valid username for your jira instance
Perhaps, I don’t right. But at least that works in Jira 8.5.1

Thank @belokurbohdan for you feedback

I used the correct USERNAME and my version is 8.5.0

But no luck:

Thank you again

Thanks
Yoyo

I got it, thanks.

Your assignee won’t be identified in this modal window, but if user clicks “Create”, assignee will be automatically set.

If you want identify your user in the “create issue” modal window, i think you should manually trigger opening Assignee picker field.

1 Like

Hi @belokurbohdan

Thank you

Finally, it works as you said: after clicking Create button

  1. The username is not the character username(John) but a ID(123456) for that name such as John(123456) ;
  2. The name can be aroused by this:

AJS.$("#assignee-field").val(‘USER_ID_NOT_USER_NAME’)
AJS.$("#assignee-field").trigger(‘input’) //arouse getting user

Thanks
Yoyo

1 Like