Automation with checkbox to be ticked
Asked by lila:

Hey there,  

I want to automatically copy information from an Epic to a linked issue (in JIra discovery product) when certain fields in the Epic are filled out. This is working for all fields except I can't get the checkbox field to update correctly. It doesnt tick the actual checkbox, just remains un-checked.   

I have tried with both smart values without success:  

{{triggerIssue.customfield_11360}}  

{{triggerIssue.customfield_11360.value}}  

![Screenshot 2024-08-02 at 1.42.08?PM.png](/t5/image/serverpage/image-id/339596iE6E7A1CA48BCBE4E/image-size/large?v=v2&px=999 "Screenshot 2024-08-02 at 1.42.08?PM.png")


Answers:
author: Bill Sheboy
body: Hi [@lila](/t5/user/viewprofilepage/user-id/4946303)

To set or clear a built-in checkbox field for JPD, I believe the [advanced edit with JSON](https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/) is required, under *More Options*.

For example, to set the field use the custom field ID and the value of 1:

```
{
  "fields" : {
    "customfield_10120": 1
  }
}
```

You wanted to conditionally set the field, based on a field in the Epic being set.

What is the type of the field in the Epic? If it was a text field, this may work, [using conditional logic](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/):

```
{
  "fields" : {
    "customfield_10120": {{#if(triggerIssue.customfield_11363.isNotEmpty())}}1{{/}}{{#if(triggerIssue.customfield_11363.isEmpty())}}0{{/}}
  }
}
```

Please substitute in your custom field ID for the R\&D field.

Kind regards,  
Bill

comments: author: lila
body: Hey Bill, both are checkboxes. The first one worked well, thank you!


author: Bill Sheboy
body: Awesome; I am glad to learn that helped!

Please consider marking this question as *answered* to help others with a similar need find solutions faster. Thanks!


author: lila
body: Thanks Bill, you're my secret hero :P


author: lila
body: Hey Bill, i just realised i cant use your first json because it only ticks the checkbox on the lined issue regardless if it is ticked or unticked at epic level. The conditional json isnt correct though according to jira?


author: Bill Sheboy
body: Hi [@lila](/t5/user/viewprofilepage/user-id/4946303)

Would you please post images of your current rule action with the JSON attempted and of the error you are seeing? Thanks!


author: lila
body: ![Screenshot 2024-08-09 at 9.06.27?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/340863i6A07B019F933076D/image-size/large?v=v2&px=999 "Screenshot 2024-08-09 at 9.06.27?AM.png")![Screenshot 2024-08-09 at 9.06.38?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/340864i8D9C56684DBE63FA/image-size/large?v=v2&px=999 "Screenshot 2024-08-09 at 9.06.38?AM.png")


author: lila
body: ![Screenshot 2024-08-09 at 9.08.12?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/340865i8F26BF9C398B2E2A/image-size/large?v=v2&px=999 "Screenshot 2024-08-09 at 9.08.12?AM.png")


author: lila
body: The rule works for everything but just the json is not correct


author: John Funk
body: Which field is 11335? And is that field selected in your Edit issue list of fields? If so, take that out there because you are updating it with the Advanced section. Not saying it will cure the syntax error, but will be cleaner.


author: lila
body: Fields 11335 is the R\&D checkbox equivalent in jira product discovery. This one doesnt appear in the drop down unfortunately so i have to specify it in the advanced field.   
Ive just tried a different way with a conditional, if R\&D (from epic) is empty \>   

{  
"fields" : {  
"customfield_11335": 0  
}  
}  

if R\&D (from epic) is not empty:  

<br />

{  
"fields" : {  
"customfield_11335": 1  
}  
}  

However, it only works for ticking the box not unticking :(


author: Bill Sheboy
body: I just tested this again for a JPD checkbox field and it worked correctly.

Please post an image of your current, complete automation rule and an image of the audit log details showing the rule execution for cases of setting and clearing the checkbox. Those may provide context for what you are observing.

Thanks!


author: lila
body: Hey Bill, i posted images of the full automation above along with audit log result.   
Your initial json worked, albeit only for selecting the boxes, not for unselecting. So by default it was selecting the checkbox alwasy. the second one is the one with the above error screenshot (not valid json)


author: John Funk
body: [@lila](/t5/user/viewprofilepage/user-id/4946303) [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

Was there ever any resolution for this?


author: Bill Sheboy
body: Hi [@lila](/t5/user/viewprofilepage/user-id/4946303)

If this is still not working...

Please copy the dynamic JSON from the *Additional fields section* and write that to the audit log before the Issue Edit action, and re-test. With that, we can observe what is causing the problem with the JSON.

Thanks!


author: John Funk
body: Hi [@lila](/t5/user/viewprofilepage/user-id/4946303)

Is this a regular Jira Checkbox field? Or is it a field from an add-on like Checklist Pro?

comments: author: lila
body: Regular :) the first json from Bill worked well - thank you!


Tags: automation

checkbox

cloud

jira-cloud