Automation rules: edit issue field syntax

l bascle June 30, 2021

I have created an automation rule to edit the 'fix version' field with {{sprint.name}} in the current issue, when the sprint changes.

Unfortunately what it does is 'add' sprint name, rather than wipe the field and replace it with the new name, so that I end up with fix versions called 'sprint1.name'-sprint2.name'-'sprint3.name'-sprint4.name'

Is it possible to specify how the value should be changed? Maybe in more options? screengrab below

Screenshot 2021-06-30 at 16.45.07.png

 

FYI, this was the original thread where I made that change.

1 answer

1 accepted

0 votes
Answer accepted
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2021

Have you looked to see if there is a action that would allow you to clear the field first?

maybe something like this? I have not tested this…

{
     "update" : {
           "Sprint" : [{"set": []}]
      }
}

l bascle June 30, 2021

Hi Jack, I do not know where to look for this, or how to add such a step.

FYI when you create the action on the issue, it's written in the field 'this field will be cleared' (see below), so the fix version field on the issue is indeed cleared, but the name itself (i.e. in previous step 'create version') is when the problem happens and names are grouped. I do not know how to condition the creation of a fix version name.

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2021

Sorry I thought what you were saying was that when your automation runs it’s adding the new value to the existing values in the field. If that is indeed the case my idea was to create an action before your current action to clear the field then you would edit the field the way you’re doing it currently.

l bascle June 30, 2021

it adds the sprint name to an existing fix version name somewhere, i just have no way of seeing where. it creates these versions, see below

Screenshot 2021-06-30 at 17.30.21.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2021

Hi @l bascle 

Are your stories in multiple sprints, such as carried over from one to the next?

If so, what you may be seeing is because the sprint field is a list of all sprints an issue has been in.

Best regards,

Bill

Like l bascle likes this
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2021

That was my thought as well and why I was suggesting to clear the Sprint field first. No I have no idea if that will work. Too I think clearing the sprint field is not necessarily a great idea.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2021

Given these are two list fields (sprint and fixVersion) I can think of two possible solutions, both with assumptions:

  • With the shown rule, assume there is at least one story with one-and-only-one sprint (the current one), and so add a condition to confirm that before creating the version:  {{issue.sprint.size}} equals 1
  • Re-think the approach, and create the version when the sprint starts, enforcing there is a one-to-one between sprints and versions, and set the fixVersion in the stories of the sprint at that time.  This assumes the version is not needed until sprint start.
Like l bascle likes this
l bascle July 1, 2021

Bill, yes you are totally right. Stories don't get completed in the sprint when they were started (boo!), and get carried over from sprint to sprint, so a story is assigned to multiple sprints.

I am not sure which approach from those you suggested is the best... the easiest?

- I tried to implement the first one, but need to define an 'else'. see belowautomationrules.png

- i am not sure I understand the second option. Are you saying basically not to use any automation?

- isn't there a 3rd option to somehow prevent addition of sprints in the sprint field? That seems to be a default feature of JIRA. I would be happy to have a 121 relationship between issues and sprints tbh, but I imagine it would mess up the reporting and burn down etc...

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2021

Hi @l bascle 

Sorry for the delay in responding.  For the second approach I noted above, you could do something like this:

  • trigger: sprint starts
  • action: create version
  • branch: on issues in the sprint
    • action: edit issue to assign the fixVersion to the newly created version
l bascle August 1, 2021

HI Bill!
Sorry for the delay from me! I was on leave, and then had to wait for a 2 week sprint to begin to see if the rule worked. This is the rule I had in place, but it seems to have failed to change versions

Screenshot 2021-08-01 at 12.03.36.png

l bascle August 2, 2021

I suspect it is the value choice in fix versions that is not right, see belowScreenshot 2021-08-02 at 08.56.57.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 2, 2021

Hi @l bascle 

Please try to type the same smart value {{sprint.name}} directly in the value for the fix version edit.  When you finish typing, the smart value will appear below the field, and you may select it.  That should use the same value which you used when creating the version.

And...if you do not want to wait to test this until the next sprint, I recommend creating a test project solely for experimenting on rules.  Then you may start/stop sprints as needed for testing, and not impact your main project in Jira.

Thanks,
Bill

Like l bascle likes this
l bascle August 3, 2021

Thanks @Bill Sheboy , that finally did it!!! So happy, had been trying to do this for so long!

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2021

Awesome!  I am glad to hear that helped.

__Bill

Like l bascle likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events