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

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

1 vote
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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.)

If I may pile onto this, as I am having the same issue but this solution did not work out for me. I think there may be more to my story though, because I am deep into this multi-branch automation (7 branches) and for some reason, a Field I have been setting using the standard "Choose field to set" --> Select values is not offering up values that it earlier was.

Literally what I mean is in one automation rule, I have multiple Edit Issue components where I edit the field "Software" to set "Office 365" and "Adobe Acrobat". In at least two of my Edit Issue components, these values are not even an option from the list. I don't really understand why that would be, especially within the same rule.

I think this is important for the problem I am having. Ultimately, I need to be able to "add" these values where values already exist (without affecting the existing ones) and I believe I'll need to use the Additional Fields section and a JSON to do so, but, that isn't working either, and I suspect it is related to the same thing causing my values not to appear in the list. I hope this makes sense.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 16, 2023

Ah, more branches, more problems.

The question I'd have is whether your branches can potentially touch different Projects, and where you have different contexts set up for the "Software" field, based on Project.

Otherwise, yeah, that's weird why some options would not be available in Automation.

If you could take some screenshots of your rule (I realize with big rules this is hard), we might be able to find something obvious.

And yes, if you want to add values without affecting existing ones, you will need to use Additional Fields + JSON.

If you already tried that, there might be something in the Audit logs that would give us a clue, so if you see any error messages, those would be good to share here as well.

The rule runs left to right (with each branch in its own column here). This is really just for organization and control while I test out all the granular pieces. Eventually I expect I will build a single if/else as opposed to having all these branches. I didn't think this could cause issues though.

Using the above-mentioned JSON example, I did get an error:

Error editing issues

EMP-51 (Field 'customfield_10071' cannot appear in both 'fields' and 'update')

 

 

My JSON object was:
{
"update": {
"Software": [{ "add": {"value": "Adobe Acrobat"}}]
}
}

I am going back to the drawing board on this. My Custom Field, currently being used on tickets, does not appear at all in Settings > Issues > Custom Fields. I cannot explain it. I am going to start over.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 17, 2023

Hi @Jarrod Reimann

Re: your error, that's telling you that you can't have the Field dropdown selector showing _and_ try to update it with JSON. If you just remove the dropdown selector (by unchecking it from the list of fields to set), that will get rid of that error.

But I have a few other questions:

1. Is this rule scoped to a single project, like so:

Screen Shot 2023-02-17 at 10.53.35 AM.png

2. In the bottom-left corner that Project, does it say if this is a company-managed project, or team-managed?

Screen Shot 2023-02-17 at 10.53.57 AM.png

Team-managed custom fields will not show up in the global Custom Fields interface. 

It seems like custom fields for Team-managed projects are ... inconsistently supported in Automation:

You are correct - it is team-managed and I sort of ended up figuring this out myself reading around. So what I've done is removed all my fields from the project and re-created the custom fields from the Custom Fields screen to ensure they are globally accessible.

Also discovered the solution you pointed out in #1, silly mistake on my part.

My rules are running now and values are adding without overwriting.

 

Thanks for your help, I'm in good shape now.

Like Darryl Lee likes this
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 17, 2023

Awesome! Glad to hear you got it worked out. Yeah, looking at the JSON, that looked just fine.

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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? :-)

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 23, 2023 • edited

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
AUG Leaders

Atlassian Community Events