I am calling create issue API with the field 'assignee' referring to a user in the project. I have tried by giving the email of user, accountId of user but the response says
I have been running into this problem with the API as well, even though I can assign issues to this user in the web browser I could not in the API.
I am converting 'displayName' (Used for a UI dropdown) to 'name' for the assignment update. When trying to find the appropriate name I hadn't included any validation for my project which resulted in the first user with a matching 'displayName' being selected, they did not have permission within my Project.
I added validation against the format of the 'name' field and now I no longer get this error.
Python Code for validating the name from the API response.
(There might be better ways but my hack and slash programming works for me.)
def get_user_name_from_display_name(display_name):
search_url = f"{jira_url}/rest/api/2/user/search?username={display_name}"
response = requests.get(search_url, headers=headers)
if response.status_code == 200:
users = response.json()
for user in users:
if user.get('displayName') == display_name:
# Validate if the 'name' field matches the format (1 letter followed by 6 numbers)
name = user.get('name')
if re.match(r'^[A-Za-z]\d{6}$', name):
return name
The actual update is done through the issue API.
update_url = f"{jira_url}/rest/api/2/issue/{issue_key}"
Hi @Vikas Mahajan, - Welcome to the community.
The error is due to the 'assignee' field not being present on the screen that is associated with the issue's creation process.
To resolve this, you will need to add the 'assignee' field to the appropriate screen in your Jira project configuration.
THen you should be able to use the 'assignee' field when creating issues through the API. Remember to use the 'accountId' of the user as the value for the 'assignee' field when making the API call Like this :
{
"fields": {
"project": {
"key": "YOUR_PROJECT_KEY"
},
"summary": "Your issue summary",
"issuetype": {
"name": "Your issue type"
},
"assignee": {
"accountId": "USER_ACCOUNT_ID"
},
// Add other fields if required
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do I add the 'assignee' field to the appropriate screen? I dont understand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Log in to Jira with administrator permissions.
Navigate to Jira Administration (cog icon) > Issues.
In the sidebar, click on 'Screens' under the 'Screens' section.
Identify the screen associated with the 'Create Issue' operation for the issue type you're trying to create. This can typically be found in the screen scheme associated with your project's issue type scheme.
Click on the screen name to edit it.
In the 'Configure Screen' page, check if the 'Assignee' field is present in the list of fields. If it is not, click on the 'Add field' button and add the 'Assignee' field.
Save the changes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I followed the steps and I can already see the Assignee field in the list of fields but when creating issue I cannot see that field in the console. For instance, I added some other field and that was instantly available to me when creating issue. The problem seems with only the Assignee field. I am trying this from the main JIRA admin account. I have the permission to assign user in the permission scheme and the screen scheme also shows that assignee field is configured but i still dont understand why this problem persists. Kindly help me with this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vikas Mahajan ,
welcome to the Atlassian community!
Probably you are trying to edit issue but Assignee field is not on the edit screen. Btw, there's a specific rest api for assignment https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-assignee-put
Try it and let me know.
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this API and the response code says 405 method not allowed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User need to have Assign user permission in the permission scheme associated to the project
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have been assigned the administrator project role and the administrator project role is allowed to assign the issues in the permission scheme. I tried doing the same even from the main JIRA admin but still unable to assign user for an issue. Kindly, help me with this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Vikas, Just following up! were you able to resolve the issue of assigning the user?
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.