Create Filter and Create Swimlane in Jira Automation
Asked by npollock:

I need a way to create a filter and a swimlane in Jira Automation.  

In our Jira project I created a script that is triggered upon a new version being made that creates 5 cards and assigns a specific version to them which all works fine.

Next what I need to do is create a swimlane so that the cards can be viewed in a specific group on our board. To group the cards right now we use filters in the swimlane.

I think I need to do next is create a filter with a value "fixVersion = {{version.name}}"(Using the smart value that is in our automation script) and assign the filter to the new swimlane. So far I have not been able to find anything that would allow me to do this. If creating one or both of these is not possible but using them as a trigger is then I might switch it around and have to do 1 other step manually.


Answers:
author: Bill Sheboy
body: Hi [@npollock](/t5/user/viewprofilepage/user-id/4211744) -- Welcome to the Atlassian Community!

Would you please explain further what you mean by "triggered upon a new version being **bad**"? For example, is there something wrong with the created version?

There is no way built-in way to dynamically add a filter or swimlane yet with automation. There are several related suggestions which you may review and vote for:

* <https://jira.atlassian.com/browse/JSWCLOUD-5720>
* <https://jira.atlassian.com/browse/JSWCLOUD-13742>
* <https://codebarrel.atlassian.net/browse/AUT-1019>

As you have the issues when you assign them to a version, I wonder if there is something else you could set that would allow a generic swimlane filter.

I haven't tried this, but I wonder if you could create one filter for a swimlane, and then edit the filter from the automation rule using the REST API:

<https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/filter-editFilter>

Best regards,

Bill

comments: author: npollock
body: First off thank you for the fast reply!  

Sorry that "bad" was supposed to be "made" I think I fat fingered it or something.  

We don't have any issues with our workflow, I am just trying to automate it to save us some future time. We are on a new project about every 2 weeks so what I have already is going to be worth it in a month or 2.  

I read up on the rest API for around 15 minutes but I was a bit confused. Ill look into it more and see if I can do anything with that.  


author: Bill Sheboy
body: This article on how to call the REST API from an automation rule will help if you go the route of dynamically changing the filter:

<https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828>


author: Bill Sheboy
body: Very cool... I just tried this using the REST API to dynamically update the filter from an automation rule and it worked, following the above instructions. :\^)


author: Darryl Lee
body: If you think that's cool...

I used the REST API to allow us to use [Project Entity Properties](https://developer.atlassian.com/cloud/jira/software/jira-entity-properties/) as a lookup table (if field1 = X and field2 = Y then set userfield1 to Z).

It's a *little* more manageable than rules with a bunch of IF blocks, but having to lookup user account IDs is a pain.

I was exploring the idea of actually setting the properties from Automation Rules itself (supported!), but the rules (and attendant workflow/issues for "mappings") would have to live in the same project, which is not optimal.


author: Tom Williams
body: Hi [@npollock](/t5/user/viewprofilepage/user-id/4211744)

[@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) is correct - no way to automate the display of the scrum or kanban board. The way I'd tackle your problem is to create a generic but dynamic filter on the board you use taking advantage of JQL.

For example...

if you work as we do and only ever have one fix version unreleased you could use this JQL query to create the swimlane:

```
fixVersion in unreleasedVersions(PROJECT)?
```

if you have multiple fix versions in the unreleased status and follow a regular pattern you could build on this JQL,

```
fixVersion in unreleasedVersions(PROJECT) and fixVersion ~ "X*"?
```

Hope this helps.

comments: author: npollock
body: we have 15ish swimlanes at the moment which are each their own "project"(not in the jira sense but for our client). We have another board that is just every project combined which is just every card on one swimlane similar to your second solution.


author: Tom Williams
body: Sounds like you dont want any more swimlanes! Perhaps the solution is just a quick filter on your board to return the issues with the latest fix version created.


author: Bill Sheboy
body: Hi [@Tom Williams](/t5/user/viewprofilepage/user-id/3514085)

When I tried the partial match on fixVersion, I got this error:
> The operator '\~' is not supported by the 'fixVersion' field.

Did that work for you? Thanks!


author: Tom Williams
body: Ah.....I hadnt thought about this. Its possible with Adaptavist scriptrunner add-on.

[https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html](https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html?)


Tags: cloud