Local issues sync after clone++ action

Originally asked by Venkatesh Pokala on 22 July 2020 (original question)


If user want to use clone ++ to clone a bug from Project source “Project A” to project destination “Project B”, any status update from the cloned bug (in ProjectB) should sync automatically to parent bug (in source project Project A) and the comments should automatically sync in both way.

Note: In the above scenario consider that they are having different WFs and mandatory fields in destination project(s).

See below screenshot of created diagram:


Answer by Francis Martens (Exalate) on 22 July 2020

Hi Venkatesh Pokala

Thanks for raising the request here - other users will benefit from it

The way to bring a cloned issue under sync with its parent is

  1. Detect the fact that an issue has been cloned
  2. Retrieve the issue id of the parent and the child (parent is source, child is the cloned issue)
  3. connect both issues using the Exalate API

Create a custom field ‘ParentID’ of type numeric

Step 1 - detect the fact that an issue has been cloned

This should be possible by tweaking the substitution variables as documented here
Assume you add a custom field ‘parent id’ and set it whenever a clone happens.
An Exalate trigger can then be used to bring the parent and child under sync

The jql would be something like

parentID is not empty

Step 2 - retrieve the parent and child id

In the connection which builds the twin (between parent and child), ensure that the parentid is contained in the replica

// add following line in the outgoing sync of the connection, using the correct customfield name

replica.customFields."ParentID" = issue.customFields."ParentID"

By adding a custom field ‘parent id’, and setting it whenever a clone happens, the custom field will be able to trigger an exalate.

Step 3 - connect parent and child

By setting the issue.id in the incoming sync, exalate will not create an issue, but connect both items

// do not create an issue but connect.  Assuming that the value is set
if (firstSync) {   
   issue.id = replica.customFields."ParentID".value

}

Have a chocolate (after validation)