Create Multiple Jira Issues Based on a Custom Number Field or variable Using Automation
Asked by Patricia Francezi:

I am using this kb

<https://confluence.atlassian.com/jirakb/create-multiple-jira-issues-based-on-a-custom-number-field-using-automation-1409089809.html>

Some answers from the community that are accepted like

<https://community.atlassian.com/t5/Jira-questions/Re-how-to-use-jira-automation-to-create-multiple-issues/qaq-p/2443304/comment-id/696566#M696566>

<https://community.atlassian.com/t5/Automation-articles/Branching-over-smart-values-in-Jira-Automation/bc-p/1921481#M546>

<https://community.atlassian.com/t5/Jira-questions/Re-Re-Jira-automation-for-creating-tasks/qaq-p/2198336/comment-id/557814#M557814>

For some reason I dont understand my rule creates only one task.

Can [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) jump here? :) please?

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

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

My issue view - "Teste automacao" is my number field. I also tried to do just with the variable created by the manual automation menu, no success too

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

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


Answers:
author: Bill Sheboy
body: Hi [@Patricia Francezi](/t5/user/viewprofilepage/user-id/1433201)

You appear to be following the technique I wrote a while ago...which replaces the value of a created variable, but *your variable names are not identical*: one is varloopValues and the other is varLoopValues.

Smart values are name, spacing, and case-sensitive. When an incorrect / unknown smart value is used, it is replaced by *null*, leading to unexpected results or errors.

Please try updating the capitalization of your variable names so they match and then re-test.

Next, did you confirm the smart value for your custom field, {{issue."Teste automacao"}}? You could write that value to the audit log to confirm it is correct. As noted earlier, if an incorrect smart value is used, it is null. You may find the correct smart value using this how-to article: <https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/>

Finally, and just to confirm, what is the type of your field driving the loop: {{issue."Teste automacao"}}? If it is not a number field, it will need to be converted using asNumber.

Kind regards,  
Bill

comments: author: Patricia Francezi
body: checking

and its a field number, yes.

i was trying to use the variable from the automation manual menu, so changed to a field, wondering if the variable is a number or not.

but the field is a number

```
  {    "id": "customfield_11772",    "key": "customfield_11772",    "name": "Teste automacao",    "untranslatedName": "Teste automacao",    "custom": true,    "orderable": true,    "navigable": true,    "searchable": true,    "clauseNames": [      "cf[11772]",      "Teste automacao",      "Teste automacao[Number]"    ],    "schema": {      "type": "number",      "custom": "com.atlassian.jira.plugin.system.customfieldtypes:float",      "customId": 11772    }
```


author: Bill Sheboy
body: That appears to be a number field.

Please add writes to the audit log after each Create Variable action to check if the value contains what is expected.

If the second variable created is incorrect, the symptom I would expect is only one loop of the branch, which is what appears to be happening.


author: Patricia Francezi
body: after changing the variable names to be the same - it didnt work, but when i changed the issue field to

issue.customfield_11772

it worked . THAAAAAAAAANK YOU!

BUT dont leave me [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) LOL

If I want to add the numbers in the summary or doing any calculation with then (like now + 3 months ahead)

Cause one task will have a due date per month based on the number

Like 8 months - 12, depends ....

Do you have any magic to share with me?


author: Bill Sheboy
body: Well, done; making progress!

Regarding using the number, do you mean of the *counter for looping*? If so, I updated that technique later to do so, as described in this post:

<https://community.atlassian.com/t5/Automation-articles/Branching-over-smart-values-in-Jira-Automation/ba-p/1741935#M546>

And remember such branching occurs in parallel; that means the issues will be created in a random order, not in the sequence of the counter.


author: Valerie Knapp
body: Hi [@Patricia Francezi](/t5/user/viewprofilepage/user-id/1433201) , thanks for your question. I am doing something similar for a JSM project.

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

The Request Type is for a new employee onboarding. Then, I am branching on the smart value of the custom field, which in this case is a tick box custom field. So, when they indicate in the onboarding ticket that they need a number of items for the new resource, I am creating a sub-task for each one.

Basically, I think the branch is the key but if you share your rule, as [@Shawn Doyle - ReleaseTEAM](/t5/user/viewprofilepage/user-id/815120) suggests, we can take a closer look.

Good luck!

comments: author: Patricia Francezi
body: [@Valerie Knapp](/t5/user/viewprofilepage/user-id/4929946) Thanks to jump in - my post was updated. I saw no difference from the posts I used to build it.


author: Shawn Doyle - ReleaseTEAM
body: Could you post your automation here? That way we can troubleshoot what is missing.

comments: author: Patricia Francezi
body: Its updated, please check


author: Shawn Doyle - ReleaseTEAM
body: so, looks like it enters the branch, however does not loop.

Can you post the value of the field you are using as the loop var?

Also, please paste the full string you have in the Create Variable boxes, the second one is truncated.

My thought is either the field isn't been seen as multiple values or the way you are parsing the field isn't creating multiple values.


author: Patricia Francezi
body: {{varLoopValues.rightPad(varLoopValues.length.plus(issue."Teste automacao"), "X").remove("NULL").replaceAll("X","X,").substringBeforeLast(",")}}

Can you post the value of the field you are using as the loop var?

Teste automacao - in the right of the screen shot

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


author: Shawn Doyle - ReleaseTEAM
body: Looks like Bill found the issue with the different variable names with the lower vs uppercase L.


author: Patricia Francezi
body: it was also the "smart value" - it was not working. so I changed to customfield id.

Anyway THANKS TO JUMP IN!!!!

I want also contribution on this if possible

If I want to add the numbers in the summary or doing any calculation with then (like now + 3 months ahead)

Cause one task will have a due date per month based on the number

Like 8 months - 12, depends ....


Tags: cloud

jira-cloud