Root Causing Sync Rules Scripts Errors

    Problem

    Script error in the sync rules.

    Outgoing sync errors

    Error Details:
    Script error for issue TEST-4168. Details: Cannot get property 'cf 1' on null object. Error line: Script272.groovy:15

    Incoming sync errors

    Error Details:
    Script error details: Cannot set property 'value' on null object. Error line: Script263.groovy:14 

    Cause

    The following reasons are possible:

    • JIRA configuration has been changed and now script could not be executed - usually it happens in case the script was working fine before, and now you are getting the error
    • The Groovy semantics is wrong - usually, the error occurs on the first sync.

    Solution

    To fix the error, you should get a clear understanding of what exactly is causing this script error and correct the script.

    Outgoing sync error example

    The error message means that the Outgoing sync script on line 15 in your sync rules caused the error. It means you need to check it.

    Cannot get property 'XXX' on null object means that this property does not exist, that's why Exalate cannot get it. In this example, Exalate tries to get a custom filed with the following code in your Outgoing script.

    issue.customFields."cf 1".value = issue.CustomFields."cf 1"

    Check whether the custom field name is correct.

    Incoming sync error example

    The error message means that the Incoming sync script on line 14 in your sync rules caused the error. It means you need to check it.

    Cannot set property 'XXX' on null object means that this property does not exist, that's why Exalate cannot set it. In this example, in your Incoming sync script, you can have this line 

    issue.customFields."cf 1".value = replica.summary 

    Exalate tries to get the ".value" of a null object and fails. You should think of how would you like to handle situations when the remote side is not sending a custom field. Typically, we recommend using null-safe access to handle absent values. Check the example below.

    replica.customFields."Custom field name"?.value = replica.summary 

    Find more details about the ?.  operator here: https://tedvinke.wordpress.com/2015/09/25/avoid-nullpointerexception-safe-navigation-with-groovy/

    To fix the error update the appropriate script processor and retry synchronization once again.