Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,297,751
Community Members
 
Community Events
165
Community Groups

REST Create Issue - Custom field not populating with default value

Edited

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

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 Nov 25, 2021

Watch this video might help you to resolve your issue.

https://youtu.be/lAECfFIWP5g

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

0 votes

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)

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
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,774 views 37 47
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you