Need help on sync-ing a checkbox field with extra setting

Originally asked by Hung Nguyen on 28 August 2020 (original question)


Hi,

I have a checkbox custom field named ‘Flagged’ with 2 options:

Blocker
Testing

And I want to sync the Blocker option from remote side to my side and back.

But I want to also set option Testing based upon the remote Status so I used the following rule in my Incoming rules:

….

def checkboxCollection = replica.customFields.“Flagged”?.value?.collect
{ a-> nodeHelper.getOption (issue, “Flagged”, a.value) }
issue.customFields.“Flagged”.value = checkboxCollection

// Special case, if remote is Testing, then turn on the flag but don’t change our status, so return
if( replica.status.name == ‘Testing’ && issue.status.name == ‘Fixed’) {
issue.customFields.“Flagged”.value += nodeHelper.getOption (issue, “Flagged”, “Testing”) //Check Testing checkbox
issue.customFields.“Peer Status”.value = replica.status.name
return
}

….
Exalate flagged the error:

Script error for issue SNC-684. Details: Cannot execute null+null. Error line: Script37.groovy:257

Row 257 is the row highlighted in Red above. What is the problem with it?

I tried to fix this myself, but could not figure out why it got error.
The strange thing is that if I remove the first 3 rows (before the IF), then it would work fine.

Thanks
HungSource: Jira Server/Datacenter (old community)