Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,930
Community Members
 
Community Events
176
Community Groups

Update checkbox field (select additional values) with automation

Hi there, 

I'd like to update a checkbox custom field via automation in a parent issue like this:

The Checkbox custom field in the parent contains 4 options:

  • Approval A is set
  • Approval B is set
  • Approval C is set
  • Approval denied

When Subtask A is resolved --> then the Checkbox field in the parent should select the Value "Approval A is set"

When Subtask C is resolved --> then the Checkobx field in the parent should select the value "Approval C is set" (additionally to "Approval A is set") 

... same goes for Subtask B.

With the standard in Automation I can only always replace the values that are already selected in the Checkbox.

But what I need: all Approvals A, B, C should be set before the parent issue can move on in the Workflow (so each subtask approval should add a value in the checkbox field).

This is why I tried to use JSON... and this is where I am completely lost. How can I update the field value so that any approval given is selected addionally to approvals that were already given?

I tried this via JSON for "Edit issue fields", but it is not working:

{
"update": {
"customfield_14809" : [{ "value" : "Approval B is set"}]
},
}

What did I do wrong?

Thanks!

2 answers

1 accepted

0 votes
Answer accepted
Darryl Lee Community Leader Jan 20, 2023

Hi @Rebecca - this was a fun one - it this took a bit of trial and error.

Since a multi-select field is kind of like Link or Request participants fields in that they can hold multiple objects, I followed those examples from Advanced field editing using JSON and came up with this, which seemed to work:

{
"update": {
"Multi Select": [{ "add": {"value": "Approval A is set"}}]
}
}

(Where "Multi Select" is the name of my field. You don't have to use field ids, and for clarity in my rules, I prefer to use field names. This is only a problem if you later rename a field. I try to avoid that.)

Hi Darryl,

I'm glad you enjoyed the challenge! :) Thanks so much for you help!

I just implemented and tested it in our Software projectr and it works exactly as we needed it to.

Best regards
Rebecca

Darryl Lee Community Leader Jan 21, 2023

Awesome to hear that it worked! I wonder if you might be willing to share a screenshot of the final rule because I was curious about how you would be identifying each subtask to check if it was closed.

Do you have a corresponding rule that automatically creates subtasks A-D and names then accordingly in their Summary?

So then do you trigger for when any Subtask is closed and then do four "ifs" to check if it is A-D and then tick the appropriate checkbox?

Because I bet I could get that down to one checkbox by using the match function.  :-}

Hi Darryl,

this is what the final rule looks like:

Automation.png

 

...and so on.

And Yes, I do have a corresponding rule that automatically creates and names subtasks A-C while editing of the subtasks is not possible. Depending on the status the Subtask is transitioned to (approved/denied), the corresponding approval in the parent is set.

I never heard of the match function, how does it work? :-)

Actually, you might not need the match function at all.

So this assumes that the Summary of your Subtasks is exactly the same text of what the checkbox option.

So for example, one of your checkbox options is:

"Rezeptprüfung und Gegenzeichnung (Produktentwickler) ist freigegeben" (thank you Google Translate?)

Then you could probably do something like this:

* IF subtask is Approved

* Then Edit issue fields Advanced

{
"update": {
"Checkboxes": [{ "add": {"value": "{{issue.summary.concat(" ist freigegeben")}}" }}]
}
}

You'd only need the text functions like match() function or replaceAll() if your checkbox options only contain part of the Summary. Like lets say your checkbox was only included who approved a subtask. So: "produktentwickler genehmigt". Then you'd use this for the value:

"{{triggerIssue.summary.match(".*\((.*)\)").concat(" genehmigt")}}"

You might use replaceAll() if your checkboxes didn't contain the approver, so you could remove it like so:

"{{triggerIssue.summary.replaceAll(" \((.*)\)","").concat(" ist freigegeben")}}"

The advantage here is that you would only need ONE IF block.

I tested that first example above and here's what it looked like:

Screen Shot 2023-01-23 at 12.56.28 AM.png

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events