Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Antony Chea
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!
December 8, 2021

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.

1 answer

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 3, 2025

Hi @Antony Chea and welcome to the community,

There is a new endpoint for creating workflow, Bulk Create Workflows. Can you try with this https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/#api-rest-api-3-workflows-create-post and let us know if that resolved the problem?

Suggest an answer

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

Upcoming Jira Events