Adding a specific Sub Task trough out an automation by adding the specific field value
Asked by Felix Gelfert:

![Snipping_Jira_Tool.PNG](/t5/image/serverpage/image-id/188671iE59903E7CCF0732E/image-size/large?v=v2&px=999 "Snipping_Jira_Tool.PNG")

Hi,

when I have already entered "Telefonvertrag/Hauptkarte" in the field "Komponenten" , I would like to be able to subsequently add the value "Multi-Sim" without having to re-create the subtask for the already existing value again. In other words: If I subsequently add the value "Multi-Sim" to the field "Komponenten", I want to get created only this specific sub task.

How can I edit my automation to get there?

Thanks!


Answers:
author: Stefan Salzl
body: Hi [@Felix Gelfert](/t5/user/viewprofilepage/user-id/4363609)

to more specify your use case:

* What would be the use case of "Telefonvertrag/Hauptkarte" is there already? Is that value filled within creation of the issue?
* regarding the field "Components" as it is possible to add 2 values within one action: what should happen if both are added the same time?
* could it be that only "Multi-Sim" is added (without "Telefonvertrag/Hauptkarte")? Or the other way round (means Multi-Sim is there already but "Telefonvertrag/Hauptkarte" is not)?

This is just for having a clear understanding of the use case as this will affect how the automation rule could look like.

Best  
Stefan

comments: author: Felix Gelfert
body: Hi [@Stefan Salzl](/t5/user/viewprofilepage/user-id/4616993)

thanks for your reply!

* exactly, usually "Telefonvertrag/Hauptkarte" and "Multi-Sim" are filled within the creation of the issue, but sometimes i have to add one or both of them afterwards.
* If both of them are added at the same time, then i would like to get both Subtasks
* "Telefonvertrag/Hauptkarte" and "Multi-Sim" are independent. They can stand alone or together.

Once again, thank you very much for your support!


author: Felix Gelfert
body: Hi [@Stefan Salzl](/t5/user/viewprofilepage/user-id/4616993) ,

do you have a solution for my Problem?

Thank you!

Felix


author: Stefan Salzl
body: Hi [@Felix Gelfert](/t5/user/viewprofilepage/user-id/4363609)

Please appologize my late response ?

So here comes my approach: First of all i would split the requirement into 2 automation rule:

1. when issue is create  
2. when value for field "Components" changes

The first rule with trigger "issue created" is built with an if/else block (see screenshot):

- if issue is created with both components --\> 2 Tasks created (1 for each component)

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

- else if issue is created with one compoent --\> create subtask for that component  
![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/193330iBFEF9B2B7A33EB4F/image-size/large?v=v2&px=999 "image.png")

- else if issue is created with other component --\> create subtask for that component  
![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/193331i24F203DE4E87D177/image-size/large?v=v2&px=999 "image.png")

2. rule: when value is added to component

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/193332iCDF736EC31E41A1F/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/193333iC4D3335AC3D0BD7C/image-size/large?v=v2&px=999 "image.png")

Please let me know if this approach would solve your problem.

Best  
Stefan


author: Stefan Salzl
body: Hi [@Felix Gelfert](/t5/user/viewprofilepage/user-id/4363609)

Even found an easier way for the first rule (on "create issue"). The branch iterates through list of components and adds a subtask for each list item:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/193334iA6D49B18FBCED127/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/193335i25CD2123B1CC6C8A/image-size/large?v=v2&px=999 "image.png")

Best  
Stefan


author: Felix Gelfert
body: Hi [@Stefan Salzl](/t5/user/viewprofilepage/user-id/4616993) ,

thank you very much for your awesome Support!!!

You actually gave me the hint i needed to solve my problem!

I?m using your smart value to run the second rule and it works pretty well.

Best

Felix

This is how i finished it up:

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


author: Stefan Salzl
body: AWESOME!!! Glad to hear it works now ?

If your problem is solved please consider to click "Accept" in order to mark this question as solved and make it easier for the community to find a solution when faced with similar questions.

Best  
Stefan


author: Felix Gelfert
body: Done :)


Tags: automation

cloud