Automation - Transition an issue after being created in a branch
Asked by I?igo Ruiz:

Hi all,

Is there a way to create a new issue inside a branch \[I know how to do this\], and then**transition this created issue**?

I would normally achieve this with branching, but because issues are created inside a branch, I don't know how to "sub-branch" a branch.

*Some more background info:*

* *I have an automation which **copies an Epic and children issues** (Epic 1 --copy--\> Epic 2). It copies all children of Epic 1 and sets the copies' parent to Epic 2. The result is Epic 2, which is an exact copy of Epic 1. This works fine.*
* *Children issues are copied in branches. There are multiple branches because I have different types of children issues and situations. For example:*

![Captura de pantalla 2024-06-14 a las 11.45.28.png](https://community.atlassian.com/t5/image/serverpage/image-id/329884i662EBE8037987881/image-dimensions/327x402?v=v2 "Captura de pantalla 2024-06-14 a las 11.45.28.png")

* *I want all copies of children issues to be transitioned to a different status just after they are created. Copied issues are created in Status A but I want them to, just after, be transitioned to Status B.*

*-\> I have tried to achieve this using a separate rule that is triggered every time an Epic 2 is created. The rule transitions all children issues to Status B. However, because rules/branches run independently, some children issues are copied after this second rule has finished and they remain in Status A.*

*-\> I have also tried to use a "for all created issues" branch (below), but again because branches run independently, some issues created in other branches are missed and remain in Status A.*

![Captura de pantalla 2024-06-14 a las 11.57.38.png](https://community.atlassian.com/t5/image/serverpage/image-id/329887i97ECF12BC9791372/image-dimensions/348x268?v=v2 "Captura de pantalla 2024-06-14 a las 11.57.38.png")


Answers:
author: Trudy Claspill
body: Hello [@I?igo Ruiz](/t5/user/viewprofilepage/user-id/5453540)

You might consider using a Label on the newly created issues to flag them as ones that need to be transitioned. Then create a second rule that is triggered by Issue Created, with a condition to look for that label, transition the issue if present, and then remove the label.

comments: author: I?igo Ruiz
body: Hi Trudy! This is easy and it worked. Thanks ?

The only problem is that when Automation removes the label, Jira sends an email notification to the Assignee because of our notification scheme (Edit Issue action). The only solution I see is to keep the label.


author: Bill Sheboy
body: Hi [@I?igo Ruiz](/t5/user/viewprofilepage/user-id/5453540)

To do this with one rule...after the issue is created, the rule could use the Send Web Request action to call the REST API function to transition the issue, passing the {{createdIssue.key}} and the correct transition id for the workflow. *As a disclaimer, I have not tried this approach in a rule before.*

Hardcoding the transition id would be simple, but if you need this to handle possible workflow changes in the future, an extra step is needed to first call the REST API to get the available transitions for the issue, search for your status, and then extract the transition id.

If you want to try this approach, here are some references:

* how-to article for calling the REST API from a rule: <https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828>
* function to get all possible transitions for the issue: <https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get>
* function to transition the issue: <https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post>

Kind regards,  
Bill


Tags: automation

cloud

jira-cloud