1
0
-1

In my Jira on-prem instance I should have to synch issues in such a way:

  • Scenario 1:

TK.Defect.1(customfield "A" = "1") > MW.Defect.1

TK.Defect.1(customfield "A" = "1").Subtask(type="Sub-Porting") > MW.Defect.1.Subtask(type="Sub-Porting")

  • Scenario 2:

TK.Defect.2(customfield "A" = "2") > NO SYNCH

TK.Defect.2(customfield "A" = "2").Subtask(type="Sub-Defect") > MW.Defect.2

TK.Defect.2(customfield "A" = "2").Subtask(type="Sub-Porting") > MW.Defect.2.Subtask(type="Sub-Porting")


I managed correctly the first senario but I have a problem in the second one, how can I find the id of the subtask with "Sub-Defect" type when generating the MW.Defect.Subtask(type="Sub-Porting"), in order to associate it as a subtask to the MW.Defect.2?


I tryied something like this in the Incoming sync:


if(replica.parentId){
     // look up the twin parent
    def localParent
    if (replica.customFields."A".value == "2"){
        replica.fields.subtasks?.collect{
            if(it.getIssueType() == "Sub-Defect"){
                localParent = nodeHelper.getLocalIssueFromRemoteId(it.id.toLong())
            }
        }
    }else{
         localParent = nodeHelper.getLocalIssueFromRemoteId(replica.parentId.toLong())
    }
    // if found, then set it, else don't create the subtask
    if(localParent){
        issue.parentId = localParent.id
    }
}


But it doesn't work..

Thanks in advance

Giancarlo

    CommentAdd your comment...