Forums

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

Jira Bulk Create Workflow API with existing statuses is always failing

Vinod K Gandham
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!
July 15, 2024

I am using Bulk create workflows API from Jira Cloud to create a workflow using existing workflow statuses within the Jira Site.

If I am trying to create a workflow with new status which is not exists in Jira Site is getting succeeded. However if the workflow status is already present is always failing with below error

{ "errorMessages": [ "Status name \"Not Started\" must be unique." ], "errors": {} }

 

 Here is the sample payload which I am using:

{
    "scope": {
        "type": "GLOBAL"
    },
    "statuses": [
        {
            "description": "",
            "name": "Not Started",
            "statusCategory": "TODO",
            "statusReference": "9a734e9b-fcf8-4b23-8574-e35609d42fb3"
        }
    ],
    "workflows": [
        {
            "description": "Action Item Workflow that applies to all projects that are either test or come via intake as a Standard project",
            "name": "Action Item Workflow",
            "startPointLayout": {
                "x": 784.0,
                "y": 67.4
            },
            "statuses": [
                {
                    "layout": {
                        "x": 736.2705078125,
                        "y": 149.29999877929689
                    },
                    "properties": {},
                    "statusReference": "9a734e9b-fcf8-4b23-8574-e35609d42fb3"
                }
            ],
            "transitions": [
                {
                    "id": "1",
                    "type": "INITIAL",
                    "from": [],
                    "to": {
                        "statusReference": "9a734e9b-fcf8-4b23-8574-e35609d42fb3",
                        "port": 1
                    },
                    "name": "Create",
                    "description": "",
                    "actions": [],
                    "validators": [
                        {
                            "ruleKey": "system:check-permission-validator",
                            "parameters": {
                                "permissionKey": "CREATE_ISSUES"
                            },
                            "id": "c11b6b06-5cfd-4606-9596-cb64bd1d1c08"
                        }
                    ],
                    "triggers": [],
                    "properties": {}
                }
            ]
        }
    ]
}

1 answer

0 votes
Vinod K Gandham
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!
July 17, 2024

Hi @Marcel Caroly 

I found some of your replies around Workflow Jira cloud APIs but none of the providing solution for above issue. Can you please check above issue and assist us in resolving the issue if you have suggestions or steps.

Here is the API reference which we are following.

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/#api-rest-api-3-workflows-create-post

If this is not the correct API to create a workflows using existing statuses, let me know the valid api reference.

Thanks

 

Marcel Caroly
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 30, 2024

Hey @Vinod K Gandham,

I don't check into community that often. Sorry. 
The issue is with the statuses in your payload. When no id is supplied we assume you are trying to making a new status with that name. So we are blocking the update because we don't allow you to create a new status with an existing name in the scope of the operation here. 

"statuses": [
{
"description": "",
"name": "Not Started",
"statusCategory": "TODO",
"statusReference": "9a734e9b-fcf8-4b23-8574-e35609d42fb3",
"id": "<ID>"
}
],

For a bit of context around why,

The workflow update/create API is declarative, it will create and update the statuses that are related to the workflow in these updates. Because we don't allocate know what status-id will be generated by the system for new statuses we went with using a reference to connect the 'statuses' to the 'workflows' in the payload.

Like John Price likes this

Suggest an answer

Log in or Sign up to answer