REST Create Issue - Custom field not populating with default value

Tyler Hammer
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 9, 2021

Hello,

I have an issue where I have a custom field that has a default value. When creating the issue type via the UI, it auto populates with the default value and all is well. 

However, when I attempt to create an issue via the Rest API, I get an error saying that I have to populate the field. 

{
  status: 400,
  elementErrors: {
    errorMessages: [
      'Sample format of a DB access: Sample format of a DB access is required.'
    ],
    errors: {}
  },
  failedElementNumber: 0
}

I would simply just populate the field, however the issue type that I'm using to create the issue does not have this field accessible on its create screen. 

{ 
status: 400,
elementErrors: {
errorMessages: [],
errors: {
customfield_11098: "Field 'customfield_11098' cannot be set. It is not on the appropriate screen, or unknown."
}
},
failedElementNumber: 0
}

Is there anyway for me to get the API to populate the value the same way the UI does? 

Ideally, I'd like to not alter the creation screen as we don't want users to edit this on this specific issue type. 

3 answers

0 votes
Sandeep Garud
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!
February 7, 2022

Was this issue ever resolved @Tyler Hammer I have same issue, custom field 

customfield_12100 is not present is UI under any label/name but when I try to create issue with API, it gives me this error:
{
    "errorMessages": [],
    "errors": {
        "customfield_12100""Field 'customfield_12100' cannot be set. It is not on the appropriate screen, or unknown."
    }
}
0 votes
Deepak Rai
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 25, 2021

Watch this video might help you to resolve your issue.

https://youtu.be/lAECfFIWP5g

Sandeep Garud
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!
February 7, 2022

@Deepak Rai  This video is generic and does not contain the answer for specific issue outlined by @Tyler Hammer 

0 votes
Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 9, 2021

Hi @Tyler Hammer 

Welcome to the community.

are the field present in the create screen when using the UI ?

If not you need to add it to this screen then make you API call.

You can't set a value for a field via API if the field is not on the screen for the operation that you will perform (create/edit)

Tyler Hammer
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 9, 2021

Hi @Mohamed Benziane

As mentioned, it is not present on the creation screen. Ideally I'd like to not add it because its not necessary when creating it in the UI. Does the API that the quickCreate uses have some back end magic that auto populates the field with the defaultValue and the REST API for whatever reason doesn't have access to this? 

Suggest an answer

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

Atlassian Community Events