Jira-Azure sync

Originally asked by Riddhi on 04 January 2021 (original question)


  • Is there a way in the Incoming Sync on the Azure side to create a parent link with a work item already existing in the same Azure project? JIRA is the source, Azure is the destination and upon creation of the workitem in Azure I want to link it with another work item;
  • Is there a way in the Outgoin Sync in Azure to send only the last Comment?

Answer by Serhiy Onyshchenko on 04 January 2021

Hello, Riddhi .

  • Is there a way in the Incoming Sync on the Azure side to create a parent link with a work item already existing in the same Azure project? JIRA is the source, Azure is the destination and upon creation of the workitem in Azure I want to link it with another work item;

In case if the parent workItrem is also synced , you may use syncHelper.getLocalIssueKeyFromRemoteId like this:

if(replica.parentId){
 
    def localParent = syncHelper.getLocalIssueKeyFromRemoteId(replica.parentId)
 
    if(localParent){
        issue.parentId = localParent.id
    }
}

In case, if the parent work item is fixed (for example, if all the synced workItems should be linked to the same workItem with id 100500):

issue.parentId = "100500"
  • Is there a way in the Outgoin Sync in Azure to send only the last Comment?

There is though one must be extra cautious with this sort of config: how would one differentiate between a comment not sent and a comment removed? What are you trying to achieve - minimizing the payload size?

Anyhow, here’s the config necessary for smooth operation:
Side A (sending side)

A B
Outgoing Sync​ ​ //...replica.comments = issue.comments.isEmpty? [] : [issue.comments.last()] Remains unchanged
Incoming sync Remains unchanged //... replica.removedComments = [] issue.comments = commentHelper.mergeComments(issue, replica)

Regards, Serhiy.