Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create issue - unable to assign the issue to someone from API

Vikas Mahajan March 21, 2023

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 

"errors": {
        "assignee": "Field 'assignee' cannot be set. It is not on the appropriate screen, or unknown."
I have the administrator permissions to the project but I still don't understand why it is throwing this error

3 answers

0 votes
Callahan_ Andrew
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 8, 2024

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}"

0 votes
Oday Rafeh
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.
March 21, 2023

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
}
}

Vikas Mahajan March 21, 2023

How do I add the 'assignee' field to the appropriate screen? I dont understand

Oday Rafeh
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.
March 21, 2023

@Vikas Mahajan 

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.

Vikas Mahajan March 22, 2023

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.

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2023

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

Vikas Mahajan March 21, 2023

I tried this API and the response code says 405 method not allowed

Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2023

User need to have Assign user permission in the permission scheme associated to the project

Vikas Mahajan March 22, 2023

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.

Sravan Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2023

Hey Vikas, Just following up! were you able to resolve the issue of assigning the user?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events