How to create parent issue and childs in same Send Web Request using automation

serge calderara
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2024

Dear all,

I have a case where I need to create a certain amount of parent issue and their corresponding child task, this using Autmation.

I have quite many parents and tasks to create and doing that in a flow step in Automation rule takes quite a lot of action and condition.

I was thinking to use instead the Send Web Request action and full the body with parent and child relation to be created.

I have try by using the following body, but that way creates only the Task and Parent is ignored

 

{
    "fields": {
       "project":
       {
          "key": "PRJ-A"
       },
       
       "parent":
        {
            "summary": "Title project A",
            "description": "test",
           
            "issuetype": {
            "name": "Story"
            }
        },
        "summary": "Child of parent Story",
        "description": "child of Title project A",
        "issuetype":
        {
            "name": "Task"
        }
   }
}

What is wrong in this body that it does not create the parent story and create its own task ?

Thanks for help

regard

1 answer

1 accepted

2 votes
Answer accepted
Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2024

Hello @serge calderara 

I am guessing you want to create a story and its sub-task, not story and task, cause thats not how hierarchy is set up.

Also, you cannot create story and sub-task together in the same API call.

You have create story first, in the response you get the created issue key. Using that, you can bulk create sub-tasks.

https://stackoverflow.com/questions/54431205/jira-api-create-issue-and-subtask-in-a-single-api-call

serge calderara
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2024

hello @Kalyan Sattaluri ,

No I need to create Stories, then linked to stories a set of Task and then each Task can have sub-task.

This is a correct layout , I do not know why you said this not how hierarhie is setup.

 

Next for the API call, I know how to do this in script runner and fetch the id ffrom the response. But here my scenario is that I want to use fully Autoamtion rule not script runner.

So in Automation there is an action call Send Web Request.

After the SendWeb request executes, how can I retrieve response Id directly in Automation for the next action to be use to create a Task and linked to the previous created parent ?

Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2024

@serge calderara 

Apologies. The title and the post did not mention that you want to create a story and task, link them, and then create sub-tasks under the task. 

Either way, that sequence is not possible. You have to create story in first send web request, then create task in next call and when creating task, you link it to story in the payload, and then when you get a success response for the task, create sub-tasks. So you need 3 send web request calls.

BTW, When you make an API call to create an issue from automation, log {{webhookResponse.body.key}} , that smart value gives you the key you just created.

 

Suggest an answer

Log in or Sign up to answer