Automation with: for each customfield allowedValues
Asked by Pascal De Cort:

Goal: In an automation, want to create a new ticket for each customfield's option.

The custom field is a **drop down selection** where you can select the location. So each new ticket should have the value from location\[0\], next location\[1\],... =\> A1, A2,... so I can use it as a text variable in the ticket to create.

In the for each I created the {{location}} variable from {{issue.fields.customfield_10087.allowedValues}} which is the list.

New ticket should have the summary prepended with "A1: some description" so I thought it would have been {{location.value}}

![Screenshot 2024-09-06 at 17.40.26.png](https://community.atlassian.com/t5/image/serverpage/image-id/346015iE2AABD7B3AAC06E7/image-size/large?v=v2&px=999 "Screenshot 2024-09-06 at 17.40.26.png")

Tried following automation:

![Screenshot 2024-09-06 at 17.41.39.png](https://community.atlassian.com/t5/image/serverpage/image-id/346012i2978CB7B7860311F/image-size/large?v=v2&px=999 "Screenshot 2024-09-06 at 17.41.39.png")

```
{{issue.fields.customfield_10871.allowedValues}}
OR
{{issue.fields.customfield_10871}}
```

does not seem to start a for each loop and create tickets.

This is the custom field definition:

![Screenshot 2024-09-06 at 17.35.24.png](https://community.atlassian.com/t5/image/serverpage/image-id/346013i95FC4B49B239FC62/image-size/large?v=v2&px=999 "Screenshot 2024-09-06 at 17.35.24.png")

Seems not to be possible?


Answers:
author: Valerie Knapp
body: Hi [@Pascal De Cort](/t5/user/viewprofilepage/user-id/4989809) , thanks for your question.

Please can you share the audit log? I have a rule like this working in a customer instance and I was able to reproduce it in one of my test environments -

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

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

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

I hate to ask the obvious question, but are you sure the custom field is configured as a multi select? or that the allowedValues are permitting to store more than one choice?

If you can share the audit log, it would be helpful to see if there are any errors or indications for where to look for further troubleshooting.

Cheers

comments: author: Pascal De Cort
body: Hi Valerie, thanks for your answer.

To answer your questions:

- The custom field is not a multi select and nothing should be selected either. It should just iterate over the allowed values and use this to in the 'to be created task' as the selected option for that field. So from the screenshot I took of the allowedValues, I want to use the \[\].id value and create a child task for each possible option.

- screenshot of the audit log shows that the smart value was not existing. But I do have it in the 'issue type' as a field, however there was nothing selected since it should create child tasks for each option anyways.

![Screenshot 2024-09-09 at 10.08.43.png](https://community.atlassian.com/t5/image/serverpage/image-id/346245iC1D37074B21563C3/image-size/large?v=v2&px=999 "Screenshot 2024-09-09 at 10.08.43.png")

It seems to me that it just don't want to iterate over the options?

Thanks!


Tags: automation

cloud

foreach

jira-cloud