Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What am I missing? Attempting to create workflow with transition rules.

I am currently calling the JIRA workflow API to create a new workflow. The goal is the ability to fully configure JIRA for projects automatically.

"/rest/api/2/workflow"

 I am able to currently create the JIRA workflow with a post call and the following payload.

workflow_payload = json.dumps({
"name": "api_workflow",
"description": "This is a workflow created through API.",
"statuses": [
{
"id": jf.get_workflow_status_id(url_base, headers, 'Open'),
"properties": {
"jira.issue.editable": "false"
}
},
{
"id": jf.get_workflow_status_id(url_base, headers, 'In Progress'),
},
{
"id": jf.get_workflow_status_id(url_base, headers, 'Reopened'),
},
{
"id": jf.get_workflow_status_id(url_base, headers, 'Resolved'),
},
{
"id": jf.get_workflow_status_id(url_base, headers, 'Closed'),
},
],
"transitions": [
{
"description": "",
"from": [],
"name": "Create Issue",
"to": "1",
"type": "initial"
},
{
"description": "",
"from": [
"1",
"3",
"4"
],
"name": "Close Issue",
"rules": {
"conditions": []
},
"to": "6",
"type": "directed"
},
{
"description": "",
"from": [
"5",
"6"
],
"name": "Reopen Issue",
"to": "4",
"type": "directed"
},
{
"description": "",
"from": [
"3"
],
"name": "Stop Progress",
"to": "1",
"type": "directed"
},
{
"description": "",
"from": [
"1",
"4"
],
"name": "Start Progress",
"to": "3",
"type": "directed"
},
{
"description": "",
"from": [
"1",
"3",
"4"
],
"name": "Resolve Issue",
"to": "5",
"type": "directed"
},
{
"description": "Closing an issue indicates there is no more work to be done on it, and it has been verified as complete.",
"from": [
"5"
],
"name": "Close Issue",
"to": "6",
"type": "directed"
}
]
})

I had written function (jf.get_workflow_status_id(url_base, headers, 'In Progress')) so that users can provide status name and retrieve the ID. In the example above, user provides "In Progress" and in its ID will show up. I am able to create workflow with transitions from one status to the next. However when I attempt to add rules/conditions, etc I get thrown an error.

"rules": {
"conditions": []
},

{"errorMessages":["Can not deserialize instance of com.atlassian.jira.workflow.bean.create.CreateWorkflowConditionBean out of START_ARRAY token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@5c6936c; line: 1, column: 392]"]}

 

Can anyone explain what this means? What I need to change? I initially copied a condition from a workflow I created through the UI, but that didn't work, so I kept removing things inside the bracket to the point, even without anything in it, it throws that error.

 

I am able to create a workflow where I provide a blank validator.

"rules": {
"validators": []
},

 

Let me know if any details is required. Shocking that following the example from "https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/#api-rest-api-3-workflow-post" didn't do anything or work.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS

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