Curl with customfield and subfield

Mainstreamowy Daniel May 25, 2023

Hi,
In Jira we have some page which have values like this:
customfield_12345 and customfield_12345:1. 

The customfields with numbers are okay, I've checked in the browser with console.

Few lines below is json which I use for curl. But when I use it I got following error: 

 {"errorMessage":"Unable to to create request because of theses errors : The field 'customfield_12650:1' is not valid for this request type 'Incident'.","i18nErrorMessage":{"i18nKey":"sd.request.create.error.failed.msg","parameters":["The field 'customfield_12650:1' is not valid for this request type 'Incident'."]}}

How should I format json message to get it working?

 

MESSAGE='{
"serviceDeskId":"1",
"requestTypeId":"12",
"requestFieldValues":{
"summary":"Heya",
"customfield_13225":"'bang bang'",
"customfield_13917":{
"value":"'$TESTENVIRONMENTVALUE'",
"id":"'$TESTENVIRONMENTID'"
},
"customfield_18611":{
"value":"'$SITEVALUE'",
"id":"'$SITEID'"
},
"description":"Hello",
"customfield_13680":{
"value":"Hey",
"id":"161239"
},
"customfield_12650":{
"value":"'$ORGANIZATIONVALUE'",
"id":"'$ORGANIZATIONID'"
},
"customfield_12650:1":{
"value":"'$ORIGINVALUE'",
"id":"'$ORIGINID'"
},
"customfield_14418":{
"value":"Poland (GMT/UTC + 01:00 hour)",
"id":"16053"
},
"customfield_12314":[
{
"value":"Not flow related",
"id":"55564"
}
],
"priority":{
"name":"1",
"id":"4"
}
}
}'

 

Thanks!

2 answers

1 accepted

1 vote
Answer accepted
Mainstreamowy Daniel May 25, 2023

Hi,
The 12345:1 was just an example.
I got this ID from elements tab from browser console, below's screenshot: 

 
halp2.png

halp3.png

Based on 12650 list, different lists should appear in 12650:1, and I want to set that with a script.
Thanks! 

Graham Twine
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.
May 25, 2023

Ah, cascading select is not updated like that.

Remove this all together

"customfield_12650:1":{
"value":"'$ORIGINVALUE'",
"id":"'$ORIGINID'"
},

Make the child value part of the field

"customfield_12650": {
"value": "$ORGANIZATIONVALUE",
"child": {
"value": "$ORIGINVALUE"
}
}
Like Mainstreamowy Daniel likes this
Mainstreamowy Daniel May 25, 2023

Thanks a lot! 
It works now :) 

2 votes
Graham Twine
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.
May 25, 2023

Hello @Mainstreamowy Daniel ,

 

Where are you getting this id 12345:1?

Please share a screen grab if possible. From what I am aware custom field IDs should never contain special characters. They only contain customfield_ followed by digits.

 

Check the field ID in Custom Fields and also confirm if the field you are looking for is on the global scope or scoped to the project and issue type you are attempting to create.

 

From your error

"The field 'customfield_12650:1' is not valid for this request type 'Incident'."

1. The ID is not a valid ID

2. The fields scope is not correct

3. The field is not associated to request type with ID 12

Suggest an answer

Log in or Sign up to answer