Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Passing mandatory custom fields for transitions using the JIRA Python API

bogdanbustan
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!
April 30, 2020

Hi,

I am trying to apply a transition on an issue that requires a mandatory field using the next format:

JIRA.transition_issue(bar_issue, 'FooTransition', customfield_bar='foo_name').

The response text to it is: 

{"errorMessages":[],"errors":{"customfield_bar":"Custom Field Bar Name is mandatory"}}

Can it be done through the Python API? Could it be done without making the particular custom fields optional?

Thank you! 

1 answer

1 accepted

1 vote
Answer accepted
Mohamed Benziane
Community Champion
April 30, 2020

Hello @bogdanbustan 

Can you try this:

jira.transition_issue(issue, '5', fields={'yourfield:value})

 https://jira.readthedocs.io/en/master/examples.html#transitions

bogdanbustan
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!
May 1, 2020

Hello @Mohamed Benziane thank you for your answer. 

Sending the transition by name was not the issue as the function find_transitionid_by_name" in "client.py" worked.

I have tried something like this but I get the same answer.

jira.transition_issue(bar_issue, 'FooTransition', fields={'customfield_bar': {'name': 'foo_name'}})

 I have also tried something like this:

jira.transition_issue(bar_issue, 'FooTransition', fields={'customfield_bar': {'name': 'foo_name'}, 'resolution': {'id':'foo_id'}})

 Where "foo_id" is the resolution ID in the custom field from a transitioned issue, done manually to say so. It is a reversed engineered attempt, I guess. It still gives back the same error message as above.

{"errorMessages":[],"errors":{"customfield_bar":"Custom Field Bar Name is mandatory"}}

Do you know if is there any API call, Python API or traditional REST API request, that returns the required format for a certain field in order to be updated? That returns something similar to a JSON or dictionary?

Thank you!

 

LATER EDIT:

I have tried it again after I have replied to you and now it works. I cannot be sure if it was related to my code or there was a bug related to the JIRA Server. The working solution for me it was:

jira.transition_issue(bar_issue, 'FooTransition', fields={'customfield_bar': {'name': 'foo_name'}})

 When I have tried them the other day there were indeed some intermittent connectivity issues. 

Suggest an answer

Log in or Sign up to answer