Hello All,
I am writing a python application to automatically create Jira issues, and am running into an issue with a required custom field that contains two parts.
The custom field is called 'Program' and is identified as 'customfield_14700'. When you choose the value / option for the Program field (ie. 'Pearl'), there is a second box next to it that is a sub-option (ie. G3 - SW).
When you query the value of the custom field :
> ticket_obj = jira.issue('MD-7347')
> print ticket_obj.fields.customfield_14700
Result :
> Pearl - G3 - SW
I am using a dictionary to build the create issue request, but am having a problem with the custom field. So far I have :
issue_dict = {
'project':{'key':'MD'},
'summary':'Automated Issue : This is a test',
'description':'Sample description of the issue.',
'issuetype':{'name':'Bug'},
'customfield_14700':{'0':'Pearl', '1':'G3 - SW'}
}
new_issue = jira.create_issue(fields=issue_dict)
I know the above customfield_14700 is wrong; it is the closest I can seem to find based on other similar questions.
I get the following when executing :
response text - {"errorMessages":[],"errors":{"customfield_14700":"Could not find valid 'id' or 'value' in the Parent Option object."}}
I am hoping I am missing something obvious; but am at a loss right now.
Has anyone encountered this scenario / have any thoughts on how to populate values into a two part custom field?
Appreciate any help / suggestions.
Thanks!
Dan.
'customfield_14700':{'0':'Pearl', '1':'G3 - SW'}
Hope this helps: Cascading Selects return their contents in an array of null and 1, so try null instead of 0
Hello Kyle,
Thank you for your suggestion! We did notice the 'null' from one of our reports / exports to excel; unfortunately more or less the same response :
issue_dict = {
...
...
'customfield_14700':{'null':'Pearl', '1':'G3 - SW'}
}
Response :
response text = {"errorMessages":[],"errors":{"customfield_14700":"Could not find valid 'id' or 'value' in the Parent Option onject."}}
Also tried various spellings (ie. Null, NULL); and tried a None: key as well; same result.
Dan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try these two:
"customfield_12345" : [{"set" : {"value" : "parentVal", "child": {"value":"childVal"}}}]
"customfield_12345" : {"value" : "parentVal", "child": {"value":"childVal"} }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is creating issues via the REST api, correct? I assumed this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Technically yes, this is being done using the python-jira library for an application we are developing.
The python-jira library allows us to work with Jira APIs from python.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, just wanted to make sure this wasn't python somehow interacting with the Java API through some sort of magic I haven't seen. Hopefully one of those two solutions above will help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried the above suggestions :
For the first one :
response text = {"errorMessages":[],"errors":{"customfield_14700":"Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean out of START_ARRAY token\n at [Source: N/A; line: -1m column: -1]"}}
For the second one :
We get an error that another custom field is required; however the error for customfield_14700 is no longer present. I think this has solved the issue; I will resolve the other custom field and let you know shortly.
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kyle, thank you very much for your suggestions! The second option resolved the issue and automation is working well now!
Solution is :
"customfield_12345" : {"value" : "parentVal", "child": {"value":"childVal"} }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, it solved my problem as well; this has worked for me
# https://jira.readthedocs.io/en/master/index.html
from jira import JIRA
import re
options = {
'server': 'https://jirahost.com/jira/',
'verify': False }
jira = JIRA(options, basic_auth=('userid', 'password'))
issue = jira.issue('PROJ-1')
issue.update(fields={'summary' : 'Re-assigned to John Doe' \
,'assignee': {'name':'johnd'} \
, "customfield_14510":{"value" : "Dec-18", "child": {"value":"25%"}} \
, "customfield_14511":{"value" : "Jan-19", "child": {"value":"75%"}} \
})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This helped me as well!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.