Branch rule / related issues by JQL doesn't accept smart values
Asked by David Leal:

I have used smart values in other JQL-related actions, but for branch rule / related issues I can't:

![Screenshot 2023-08-31 at 9.20.05 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/278245i5CD7E803691B05C0/image-size/large?v=v2&px=999 "Screenshot 2023-08-31 at 9.20.05 AM.png")

Am I doing something wrong, or is it a limitation in this case? I haven't read any limitations that restrict using smart values in this context. If so was it reported? Thanks


Answers:
author: Jehan Bhathena
body: Hi [@David Leal](/t5/user/viewprofilepage/user-id/1567948) ,

Going from what the error says, you may have missed out on adding a Action/Component after the JQL branch. I tried a similar configuration at my end got the error :

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/278366i7A751F46F3085B7B/image-dimensions/272x138?v=v2 "image.png")

comments: author: David Leal
body: [@Jehan Bhathena](/t5/user/viewprofilepage/user-id/5119409) correct, that was the issue, I was looking for some more complex errors related to the smart values, without looking at the obvious.


author: Bill Sheboy
body: Hi [@David Leal](/t5/user/viewprofilepage/user-id/1567948)

A couple of things...

* There appears to be a typo in the smart value for userInputs in that JQL
* Are there multiple values in that input, or just one value? If multiple you may need to parse that into a list to work: CSV with quotation marks around each value.

Kind regards,  
Bill

comments: author: David Leal
body: Thanks [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) for your help on this. Do you mean I didn't add a space after in and I put user.Inputs instead of userInputs? I tested also the following:

```
labels in ({{userInputs.remLabels}})
```

but I am getting the same error. Yes, it is a list of values, but at this point, since it is a user input from a manual trigger rule, the error is not because of that. The input is in CSV format. Good point, I didn't know I needed to put quotation marks around each value. I am getting the error not executing the rule, but publishing the rule.

**Note**: I was able to convert the input with comma-separated values to add the quotation mark as follows, maybe there is an easier way, but the following works:

```
{{userInputs.keyList.leftPad(userInputs.keyList.length().plus(1), "\"").replace(",","\",\"").concat("\"")}}
```

For example, if the input is: a,b,c,d will return: "a","b","c","d". If I store the result in a smart variable. {{csvKeyList}}. Then using the split function the final result is a list, for example: {{csvKeyList.split(",").first}}, I am able to get the first element.

Thanks for any additional help


author: Bill Sheboy
body: Hi, and sorry for the delay in responding. It looks like you got it figured out.

For the CSV part, I was suggesting using an iterator to add the values to build the JQL. Something like this:

```
labels IN ( {{#userInputs.keyList}}"{{.}}"{{^last}}, {{/}}{{/}} )
```

That would iterate over the input values, wrapping each one in double-quotes, and adding a comma between each one. The {{\^last}} part is to ensure their is not comma at the end.


author: David Leal
body: Thanks, [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) good idea, it would require converting the input string into a list first via split(",") for example.


Tags: advanced-roadmaps

automation

cloud