How to sync fields from Parent issue to sub-task?

Originally asked by Vedant Kulkarni on 20 February 2020 (original question)


I have created one sync to copy fields from Parent to Sub-task, but it is giving me the following error:-

Could not create an issue with type `Sub-task` on project `ST`: Issue type is a sub-task but parent issue key or id not specified.

But I do not want to create a Sub-task. In fact, after creating a ‘Sub-task’ I want to trigger an exalate connection which will copy all field from Parent to Sub-task.

Is this possible?Source: Jira Cloud (old community)


Comments:

Francis Martens (Exalate) commented on 20 February 2020

Can you provide the incoming sync processor?

Vedant Kulkarni commented on 24 February 2020

Here is the incoming sync. I followed this link: https://docs.idalko.com/exalate/display/ED/How+to+synchronize+tasks+and+subtasks. I want to sync parent and subtask using the local connection that means in the same project. And it should not create a new ticket, in fact, I want to sync issues when user creates subtasks in a project. Is this possible?

Incoming Sync

if(firstSync && replica.parentId)
{
issue.typeName     = "Sub-task"
 def localParent = nodeHelper.getLocalIssueFromRemoteId(replica.parentId.toLong())
    if(localParent){
        issue.parentId = localParent.id
    } else {
       throw new com.exalate.api.exception.IssueTrackerException("Subtask cannot be created: parent issue with remote id " + replica.parentId + " was not found. Please make sure the parent issue is synchronized before resolving this error" )
    }
issue.summary      = replica.summary
issue.description  = replica.description
issue.labels       = replica.labels
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
issue.reporter     = replica.reporter
}

Outgoing Sync

replica.key            = issue.key
replica.type           = issue.type 
replica.assignee       = issue.assignee 
replica.reporter       = issue.reporter
replica.summary        = issue.summary
replica.description    = issue.description
replica.labels         = issue.labels
replica.comments       = issue.comments
replica.resolution     = issue.resolution
replica.status         = issue.status
replica.parentId       = issue.parentId
replica.priority       = issue.priority
replica.attachments    = issue.attachments
replica.project        = issue.project
Vedant Kulkarni commented on 24 February 2020

Oh got it. Thanks for the clarification.

So, instead of synching the existing subtask, is it possible to trigger an exalate connection on Parent issue which results in creating a new Subtask with required fields from Parent in the same project?

Francis Martens (Exalate) commented on 24 February 2020

Yes - that’s possible, but only once.

Vedant Kulkarni commented on 24 February 2020

Thanks once again. I tried to create the exalate connection using this doc link https://docs.idalko.com/exalate/display/ED/How+to+synchronize+tasks+and+subtasks. But it is not working for local connections.

Is there any other tutorial for local connections to do with Parent and Subtask?

Francis Martens (Exalate) commented on 04 September 2020

If still relevant - Can you provide some details about ‘not working for local connections’?

Answer by Francis Martens (Exalate) on 24 February 2020

Ah

> And it should not create a new ticket, in fact, I want to sync issues when user creates subtasks in a project. Is this possible?

Not really possible.
The thing is that you can only create a single twin per connection/parent issue.
(we are working on extending the product, but that feature is still in twilight zone)

The consequence that even if you manage to get the sync right, you can only do it between a parent and a single subtask.
If you want to sync between a parent and another subtask, you will need a new connection.

This is a dead-end atm imo