How to Sync a Checkbox Custom Field in Jira On-premise

    This article shows how to synchronize a checkbox custom field.

    Let's assume you have a checkbox named Product Choices.

    Source Side

    Outgoing sync

     replica.customFields."Product Choices" = issue.customFields."Product Choices"

    Destination Side

    Collect all values of the remote checkbox and find the corresponding value.

    Incoming sync

    /*
    ** Collect all values of the remote checkbox and find the corresponding value
    ** Ignore in case the value is not found
    */
    def checkboxCollection = replica.customFields."Product Choices".
    								value?.
    								collect{
    										a->
    										nodeHelper.getOption (issue, "Product Choices", a.value) 
    										}
    issue.customFields."Product Choices".value = checkboxCollection
    
    

    Check/uncheck depending of certain conditions.

    Incoming sync

    if(replica.status.name == "Done"){
      issue.customFields."Remote Status".value = ["Done"] //Check Done checkbox
    }else{
       issue.customFields."Remote Status".value = [] //Uncheck all checkboxes
    }