Empty update

Originally asked by Ezadin Mahmoud on 20 April 2021 (original question)


Hello Support Team

We have the problem that when updating the ticket on the remote side,
the “destination-Labels” field is updated even if there is no update of the “source_Labels” field on the replica site.The field is updated with an empty value.
What is the reason for this update and how to stop the empty updates?

here is my code.

issue.customFields.“destination-Labels”.value = [nodeHelper.getLabel(“”)]
replica.customFields.“source_Labels”?.value?.split(', ')?.each

{ issue.customFields.“destination”.value += nodeHelper.getLabel(it) }

Best regards
Ezadin Mahmoud


Answer by Francis Martens (Exalate) on 21 April 2021

Following statement is clearing the destination-Labels field

issue.customFields."destination-Labels".value = [nodeHelper.getLabel("")]

Remove it and see if that solves the problem


Comments:

Ezadin Mahmoud commented on 22 April 2021

Hello Francis,

Thank you for the Answer

After deleting the line, I noticed this update behavior.

  1. The deletion caused the empty update to stop.
  2. On the source side, when the “source_Labels” is changed from Label1 to Label2, the “destination_Labels” is updated to Lable1 Label2.
    This is not a correct behavior. The “destination_Labels” should be changed to Lable2, not Label1 Label2.
  3. If you delete the value of “source_Labels” on the source_side, the value of “destination_Labels” is not deleted and still has the old value Lable1 Label2.

So after deleting the line, “destination_Labels” gets a different value than on the “source_Labels” and that doesn’t need to be, “source_Labels” and “destination_Labels” must have the same value.
So I think the code itself is correct, but it must only be executed if there really is an update.

Best regards

Ezadin