I used the bulk get workflows API (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/#api-rest-api-3-workflows-post) to fetch my workflows.
Then, without modifying any of the workflow JSON, I tried using validate (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/#api-rest-api-3-workflows-update-validation-post) and bulk update (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/#api-rest-api-3-workflows-update-post) to update all of them.
Some of the workflows updated successfully. But a few gave the error “You must use a unique status name”.
I checked the JSON exported, it doesn’t seem there are duplicate status id/reference.
I can edit and publish those workflows in browser without issue. But with the API, they always give the same error message.
How can I fix this?
Edit:
This is the workflow payload for validate:
{
"payload": {
"statuses": [{
"id": "10009",
"statusReference": "10009",
"name": "Canceled",
"statusCategory": "DONE",
"scope": {
"type": "GLOBAL"
},
"description": "This was auto-generated by Jira Service Management during workflow import",
"usages": []
}, {
"id": "10011",
"statusReference": "10011",
"name": "Waiting for approval",
"statusCategory": "TODO",
"scope": {
"type": "GLOBAL"
},
"description": "This was auto-generated by Jira Service Management during workflow import",
"usages": []
}, {
"id": "10010",
"statusReference": "10010",
"name": "Escalated",
"statusCategory": "IN_PROGRESS",
"scope": {
"type": "GLOBAL"
},
"description": "This was auto-generated by Jira Service Management during workflow import",
"usages": []
}, {
"id": "10006",
"statusReference": "10006",
"name": "Waiting for support",
"statusCategory": "IN_PROGRESS",
"scope": {
"type": "GLOBAL"
},
"description": "This was auto-generated by Jira Service Management during workflow import",
"usages": []
}, {
"id": "5",
"statusReference": "5",
"name": "Resolved",
"statusCategory": "DONE",
"scope": {
"type": "GLOBAL"
},
"description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.",
"usages": []
}, {
"id": "10008",
"statusReference": "10008",
"name": "Pending",
"statusCategory": "IN_PROGRESS",
"scope": {
"type": "GLOBAL"
},
"description": "This was auto-generated by Jira Service Management during workflow import",
"usages": []
}, {
"id": "10007",
"statusReference": "10007",
"name": "Waiting for customer",
"statusCategory": "IN_PROGRESS",
"scope": {
"type": "GLOBAL"
},
"description": "This was auto-generated by Jira Service Management during workflow import",
"usages": []
}, {
"id": "6",
"statusReference": "6",
"name": "Closed",
"statusCategory": "DONE",
"scope": {
"type": "GLOBAL"
},
"description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.",
"usages": []
}, {
"id": "3",
"statusReference": "3",
"name": "In Progress",
"statusCategory": "IN_PROGRESS",
"scope": {
"type": "GLOBAL"
},
"description": "This issue is being actively worked on at the moment by the assignee.",
"usages": []
}
],
"workflows": [{
"scope": {
"type": "GLOBAL"
},
"version": {
"versionNumber": 1,
"id": "ce343531-7424-4ef9-9bb5-5e53b53730a1"
},
"id": "95fdd744-11a9-472f-8598-695e2689ead7",
"name": "UT2: Service Request Fulfilment with Approvals workflow for Jira Service Management",
"description": "This Jira Service Management Service Request Fulfilment with Approvals workflow was generated for Project UT2",
"isEditable": true,
"usages": [],
"statuses": [{
"statusReference": "10008",
"properties": {},
"deprecated": false
}, {
"statusReference": "10009",
"properties": {},
"deprecated": false
}, {
"statusReference": "10010",
"properties": {},
"deprecated": false
}, {
"statusReference": "10007",
"properties": {},
"deprecated": false
}, {
"statusReference": "3",
"properties": {},
"deprecated": false
}, {
"statusReference": "6",
"properties": {},
"deprecated": false
}, {
"statusReference": "10006",
"properties": {},
"deprecated": false
}, {
"statusReference": "5",
"properties": {},
"deprecated": false
}, {
"statusReference": "10011",
"properties": {
"approval.active": "true",
"approval.condition.type": "number",
"approval.condition.value": "1",
"approval.field.id": "customfield_10182",
"approval.transition.approved": "901",
"approval.transition.rejected": "911"
},
"deprecated": false
}
],
"transitions": [{
"id": "1",
"type": "INITIAL",
"from": [],
"to": {
"statusReference": "10011"
},
"name": "Create issue",
"description": "",
"actions": [],
"validators": [{
"ruleKey": "system:check-permission-validator",
"parameters": {
"permissionKey": "CREATE_ISSUES"
},
"id": "27685c46-11a3-451c-b548-4de6265b97f3"
}
],
"triggers": [],
"properties": {}
}, {
"id": "781",
"type": "DIRECTED",
"from": [{
"statusReference": "10007"
}
],
"to": {
"statusReference": "10006"
},
"name": "Respond to support",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"properties": {}
}, {
"id": "921",
"type": "DIRECTED",
"from": [{
"statusReference": "10006"
}, {
"statusReference": "10007"
}, {
"statusReference": "10008"
}, {
"statusReference": "3"
}, {
"statusReference": "10011"
}
],
"to": {
"statusReference": "10009"
},
"name": "Cancel request",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10384"
},
"id": "dea057bc-2d2a-40ed-8a15-edbf58a099c8"
},
"properties": {
"servicedesk.customer.transition.active": "true",
"servicedesk.customer.transition.resolution": "10001"
}
}, {
"id": "951",
"type": "DIRECTED",
"from": [{
"statusReference": "5"
}
],
"to": {
"statusReference": "3"
},
"name": "Back to in progress",
"description": "",
"actions": [{
"ruleKey": "system:update-field",
"parameters": {
"field": "resolution",
"value": "",
"mode": ""
},
"id": "c1de0aa9-e159-4cf1-9e38-ef99de9d9a47"
}
],
"validators": [],
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10386"
},
"id": "a062d0aa-5539-45b4-a91a-c6e0d38c8915"
},
"properties": {}
}, {
"id": "961",
"type": "DIRECTED",
"from": [{
"statusReference": "5"
}, {
"statusReference": "10009"
}
],
"to": {
"statusReference": "6"
},
"name": "Close",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"properties": {}
}, {
"id": "851",
"type": "DIRECTED",
"from": [{
"statusReference": "10006"
}, {
"statusReference": "10008"
}
],
"to": {
"statusReference": "10007"
},
"name": "Respond to customer",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"properties": {}
}, {
"id": "941",
"type": "DIRECTED",
"from": [{
"statusReference": "10007"
}
],
"to": {
"statusReference": "10010"
},
"name": "Escalate this issue",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10386"
},
"id": "2bec1e71-3282-442d-a5e3-396e8326f4b3"
},
"properties": {}
}, {
"id": "911",
"type": "DIRECTED",
"from": [{
"statusReference": "10011"
}
],
"to": {
"statusReference": "5"
},
"name": "Declined",
"description": "",
"actions": [{
"ruleKey": "system:update-field",
"parameters": {
"field": "resolution",
"value": "10004",
"mode": ""
},
"id": "8c648753-db60-49de-a8ef-9918caa1f688"
}
],
"validators": [],
"conditions": {
"operation": "ALL",
"conditionGroups": [],
"conditions": [{
"ruleKey": "system:block-in-progress-approval",
"parameters": {},
"id": "24760b2f-ebf7-4b78-87fd-63124e0a8d6c"
}
]
},
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10384"
},
"id": "194052e2-58d4-46ec-936c-9c3713494d6e"
},
"properties": {}
}, {
"id": "871",
"type": "DIRECTED",
"from": [{
"statusReference": "10006"
}, {
"statusReference": "3"
}
],
"to": {
"statusReference": "10008"
},
"name": "Pending",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10385"
},
"id": "9f1e24f9-052e-4853-a56e-bc139cc0974b"
},
"properties": {}
}, {
"id": "931",
"type": "DIRECTED",
"from": [{
"statusReference": "10006"
}
],
"to": {
"statusReference": "10010"
},
"name": "Escalate",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10386"
},
"id": "574295a3-4a5a-4c09-8915-a1b07c3b7646"
},
"properties": {
"servicedesk.customer.transition.active": "true",
"servicedesk.customer.transition.resolution": ""
}
}, {
"id": "891",
"type": "DIRECTED",
"from": [{
"statusReference": "10006"
}, {
"statusReference": "10008"
}, {
"statusReference": "10010"
}
],
"to": {
"statusReference": "3"
},
"name": "In progress",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10386"
},
"id": "127b50a6-eb88-4700-9d81-055c11f54942"
},
"properties": {}
}, {
"id": "901",
"type": "DIRECTED",
"from": [{
"statusReference": "10011"
}
],
"to": {
"statusReference": "10006"
},
"name": "Approved",
"description": "",
"actions": [],
"validators": [],
"conditions": {
"operation": "ALL",
"conditionGroups": [],
"conditions": [{
"ruleKey": "system:block-in-progress-approval",
"parameters": {},
"id": "cc8f2229-f4ce-484f-b98a-a625493d3609"
}
]
},
"triggers": [],
"properties": {}
}, {
"id": "761",
"type": "DIRECTED",
"from": [{
"statusReference": "10006"
}, {
"statusReference": "10007"
}, {
"statusReference": "10008"
}, {
"statusReference": "3"
}
],
"to": {
"statusReference": "5"
},
"name": "Resolve this issue",
"description": "",
"actions": [],
"validators": [],
"triggers": [],
"transitionScreen": {
"ruleKey": "system:transition-screen",
"parameters": {
"screenId": "10384"
},
"id": "b66d45c2-e998-4ab3-9f1e-278ffae6f0b4"
},
"properties": {}
}
]
}
]
}
}
And this is the error messages in full:
{"errors": [{
"type": "STATUS",
"message": "You must use a unique status name.",
"code": "NON_UNIQUE_STATUS_NAME",
"level": "ERROR",
"elementReference": {"statusReference": "10006"}
}]}
I do have two statuses with the same name:
I think they got created by Migration Assistant… all the projects were migrated from Data Center.
But doesn’t the statuses array at the begining already pointing to them by id?