Questions to create a JIra automation
Asked by Rodrigo Xavier:

Hello everyone, everything good?

lease, I believe that this doubt is basic for many, but ultimately I was not able to reach the result I expected.  
I have a project and within them there are hundreds of *Components*, I would like to make an automation that does the following:

1. Trigger when creating a subtask.
2. Make a public comment.
3. Assign those responsible
4. After all change the status to Done.

My problem is that when creating this automation it is functional in all my project, that is, whenever someone creates a subtask *(in any component)* the automation works.  
I just wanted it to work in a single component, so it doesn't hurt other teams.  
I don't know if I managed to explain it well, but the attached print, and the automation I created.

![Jira.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262487i8AF3EC696454911C/image-size/large?v=v2&px=999 "Jira.PNG")


Answers:
author: Tim Perrault
body: Hi [@Rodrigo Xavier](/t5/user/viewprofilepage/user-id/5146782)

I think I understand what you want. I would try something like I have in my screenshot:

![01ja.png](https://community.atlassian.com/t5/image/serverpage/image-id/262491i5D6CE9AD5FE93CBE/image-size/large?v=v2&px=999 "01ja.png")

comments: author: Rodrigo Xavier
body: Hi, [@Tim Perrault](/t5/user/viewprofilepage/user-id/165835) sorry I didn't see your message.  
Thanks a lot for his answer.  
I don't know if it could be the configuration that my organization made but I don't see some components and fields, as I see in my test environment.  
I tried to use this same rule, but I didn't find the *Issue Type* for example.  
Would it be possible to do this with JQL?

![Jira3.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262492i512BFC0887CC5225/image-size/large?v=v2&px=999 "Jira3.PNG")


author: Tim Perrault
body: Both the conditions I used were the Issue fields condition. Are you not able to select Issue Type in the Field section?

![00ja.png](https://community.atlassian.com/t5/image/serverpage/image-id/262494i8D87EB1D7EE89FB7/image-size/large?v=v2&px=999 "00ja.png")

But yes using the JQL condition should also work.

issuetype = Sub-task


author: Rodrigo Xavier
body: I managed to find the field, I was looking in the wrong place sorry. I did the same test as your print and then I reversed the component, in both cases it shows the message.

##### **ACTION DETAILS:**
ISSUE CONDITION
The following issues passed:
LPBRI-663
**ISSUE CONDITION:**
The following issues did not match the condition:
LPBRI-663 {#toc-hId--1560049184}


author: Tim Perrault
body: So the rule did not work? Can you post a screenshot of your rule?


author: Rodrigo Xavier
body: Of course.  
The 04:32:38 log was generated following your example (your print)  
The 04:34:33 log was generated according to the current image.

![Jira4.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262502iB55A4474C4334837/image-size/large?v=v2&px=999 "Jira4.PNG")


author: Tim Perrault
body: ok it looks like the sub-task LBRI-663 does not have a component when it is created. When you create a sub-task does it have a pop-up screen where you can add the component? Basically the component will need to be on the issue when you are creating it. If you add the component later the automation won't do anything.


author: Rodrigo Xavier
body: Na verdade, quando a subtarefa ? criada, ela ? criada sem o campo do componente preenchido, somente depois de criada ela aparece.  
Na impress?o, a tarefa tem o campo componente preenchido corretamente.  
Depois de criar a subtarefa, o campo n?o ? preenchido.  
Com base na sua an?lise, eu j? deveria criar essa subtarefa com o campo Componente corretamente preenchido como Governan?a, correto?

![Jira5.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262505i043FB5CA7C66EBCE/image-size/large?v=v2&px=999 "Jira5.PNG")![Jira6.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262506i225D8293D8D33F25/image-size/large?v=v2&px=999 "Jira6.PNG")


author: Tim Perrault
body: yes the component field will need to be filled in if your trigger is when an issue is created to work. You could use the Field value changed trigger if you didn't want the rule to run on creation.


author: Rodrigo Xavier
body: Automation this way works, however any subtasks that are created in any component will use my rule.  
These are the components I have in my project.  
And the idea is that the rule only works when subtasks are created in the Governance component.![Jira7.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262511i500A11F881992E6E/image-size/large?v=v2&px=999 "Jira7.PNG")![Jira8.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262512i4DBA39CF1373E1AF/image-size/large?v=v2&px=999 "Jira8.PNG")


author: Tim Perrault
body: You could use the issue updated trigger and add the condition for component back. That should work I think.

![000ja.png](https://community.atlassian.com/t5/image/serverpage/image-id/262514i502FC5B60DC4FD74/image-size/large?v=v2&px=999 "000ja.png")


author: Rodrigo Xavier
body: I will test it and post the result here.  
Tim thank you very much for your patience and cooperation.  
Here in Brazil it's already 18:20 pm on Friday, the body has to rest a little. rsrs  
As soon as I test it I'll let you know.


author: Rodrigo Xavier
body: Hello [@Tim Perrault](/t5/user/viewprofilepage/user-id/165835) [@Hana Ku?erov?](/t5/user/viewprofilepage/user-id/1226304) everyone, everything good?  
***Tim*** managed to do the automation here.  
I left it that way and even acted ps other teams didn't complain about subtasks being automatically closed, so I believe I managed to reach the desired result. Now just refine the code.  
Thank you very much for your partnership and help. Automation was like that.

![Jira9.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262995i2D5C824D8E52F962/image-size/large?v=v2&px=999 "Jira9.PNG")


author: Hana Ku?erov?
body: Hi [@Rodrigo Xavier](/t5/user/viewprofilepage/user-id/5146782) ,

welcome to the Atlassian community!

I believe what you need is to set the scope of the rule to the single project.

It can be found in the Rule details section.

comments: author: Rodrigo Xavier
body: Hi [@Hana Ku?erov?](/t5/user/viewprofilepage/user-id/1226304)

Thanks a lot for the quick feedback.  
I had looked before but I didn't find any relationship.  
Would I have to change the "Actor" field?![Jira1.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/262490iC10AD037CAE98D41/image-size/large?v=v2&px=999 "Jira1.PNG")


author: Hana Ku?erov?
body: Thank you.

I can see the scope is ok - single project LPBR ICT.

I didn't understand you correctly.

Probably [@Tim Perrault](/t5/user/viewprofilepage/user-id/165835) is right, you need to add condition with your component.


Tags: jira

jira-cloud

new-to-jira