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
Community Members
Community Events
Community Groups

How to resolve the 500 error when importing bulk custom fields?

I am trying to run the curl command to import bulk custom fields from my command line.

The command looks like below:

curl -u <username>:<password> "https://<JIRA url>/rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.jira.admin.BulkImportCustomFieldValues" -H "X-Atlassian-token: no-check" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Accept: application/json" --data "@add-opt.json"

contents of add-opt.json:

"FIELD_FCS":"Default Configuration Scheme for samplelist2",

I am getting the following error:

{"message":"For input string: \"Default Configuration Scheme for samplelist2\"",
"status-code":500,"stack-trace":"java.lang.NumberFormatException: For input stri
ng: \"Default Configuration Scheme for samplelist2\"\r\n\tat com.onresolve.scrip
portCustomFieldValues.groovy:83)\r\n\tat com.onresolve.scriptrunner.canned.jira.

Please help in figuring out where I am going wrong.

Thank you

2 answers

1 accepted

0 votes
Answer accepted

Got it solved by giving the context Id of the custom field but not the field configuration scheme ID.

Thank  you Nick for helping me resolving it.

0 votes

Field_FCS expects the ID of the custom field, not a random string (that doesn't even look like a field name).

If your field is called "Fred", go to the list of custom fields and find it, and click on an edit or configure link.  You should find the url contains the id - either as ...=customfield_10045... or  You just need the number part of that.

When I put custom field ID in the Field_FCS ,I get the below error:


FIELD_FCS":"No field config scheme with this ID found, or you have not selected


"FIELD_FCS": "10501",
"FIELD_IMPORT_VALUES": "drake\ngaga",

I'm really sorry, I was working on something related and mixed that up with what I read here.  I've misread your code totally. 

You need the FCS to be the ID of the field configuration scheme, not the field.  You originally were halfway there with the name of the config scheme, but you needed to replace it with the id of the config scheme.  My misdirection to the field is totally wrong.

To get the id of the FCS, it's similar - go to the list of field configuration schemes, find the one in use for the project you're importing into and find one of the edit links - that again should give you an type link


Thank you Nick for the quick response. I have created a field configuration scheme and associated with a project and substituted "field_fcs" with field configuration scheme id=10000.It throws the follwoing error:

{"message":"No custom field for issuetype. This should not happen. Data is likel
y to be corrupt.","status-code":500,"stack-trace":"com.atlassian.jira.exception.
DataAccessException: No custom field for issuetype. This should not happen. Data
is likely to be corrupt.\r\n\tat com.atlassian.jira.issue.fields.config.FieldCo
nfigImpl.getCustomField(\r\n\tat com.atlassian.jira.issu
e.fields.config.FieldConfig$ Source)\r\n\tat com.onre
portCustomFieldValues.groovy:96)\r\n\tat com.onresolve.scriptrunner.canned.jira.

Ok, great.  The problem now is that your field does not exist, or if it does, it is not valid for the project/issuetype you are trying to import into. 

Check that

  • the field configuration does not hide the field
  • the field exists on the right screen(s)
  • the field context makes the field valid for the project/issuetype

A simple trick to help you with this - go to the project and try to create an issue.  You will find that the field is not offered to you.  Look towards the top right for the "where's my field" link and try that.  It should guide you through getting the field on to your screen.

I have associated my custom field to "TEST:Scrum Default Issue Screen"  and I see my custom field when I open a create issue window for the corresponding project TEST.

Ok, that suggests that you're trying to add your data into another project then.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events