// if(firstSync){ // // If it's the first sync for an issue (local issue does not exist yet) // // Set project key from source issue, if not found set a default // issue.projectKey = nodeHelper.getProject(replica.project?.key)?.key ?: "TEST" // // Set type name from source issue, if not found set a default // issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task" // } // issue.summary = replica.summary // issue.description = replica.description // issue.labels = replica.labels // issue.comments = commentHelper.mergeComments(issue, replica) // issue.attachments = attachmentHelper.mergeAttachments(issue, replica) if(firstSync){ // If it's the first sync for an issue (local issue does not exist yet) // Set project key from source issue, if not found set a default //issue.projectKey = "MTCI191" if((replica.project.key == "AUD40V" || replica.project.key == "AUDCMV" || replica.project.key == "AUDCMB" || replica.project.key == "AUDECOCH" || replica.project.key == "AUDECOG30" || replica.project.key == "AUDSTDG40") && (replica.type.name == "Bug" || replica.type.name == "Bug_QC")){ issue.projectKey = "MTCI191" } /*if((replica.project.key == "AUD40V" || replica.project.key == "AUDECO" || replica.project.key == "AUDSTDG30" || replica.project.key == "AUDCMV" || replica.project.key == "AUDCMB" || replica.project.key == "AUDECOCH" || replica.project.key == "AUDECOG30" || replica.project.key == "AUDSTDG40") && replica.type.name == "Bug"){ issue.projectKey = "MTCI197" } if((replica.project.key == "AUD40V" || replica.project.key == "AUDSTDG40" || replica.project.key == "AUDD20V") && replica.type.name == "Bug"){ issue.projectKey = "MTCI285" } if(replica.project.key == "AUDD20V" && replica.type.name == "Bug"){ issue.projectKey = "MTCI196" } if((replica.project.key == "AVNG5WIDEP" || replica.project.key == "AVNG5WIDE") && replica.type.name == "Bug"){ issue.projectKey = "MTCI217" } if((replica.project.key == "AVNG5WIDEP" || replica.project.key == "AVNG5WIDE") && replica.type.name == "Bug"){ issue.projectKey = "MTCI228" } if((replica.project.key == "CLUCDHMPE" || replica.project.key == "CLUCDPE") && replica.type.name == "Bug"){ issue.projectKey = "MTCI183" } if((replica.project.key == "IBUFT" || replica.project.key == "SWVVTEAM") && replica.type.name == "Bug"){ issue.projectKey = "MTCI201" } //if((replica.project.key == "AUDCMB" || replica.project.key == "AUDCMV") && replica.type.name == "Bug"){ //issue.projectKey = "MTCI190" //} if((replica.project.key == "AUDECOCH" || replica.project.key == "AUDECOG30" || replica.project.key == "AUDSTDG40") && replica.type.name == "Bug"){ issue.projectKey = "MINR067" }*/ if((replica.project.key == "HUDSTDAPP" || replica.project.key == "CLUGN7" || replica.project.key == "HUDSTD") && (replica.type.name == "Bug" || replica.type.name == "Bug_QC")){ issue.projectKey = "MTCI215" } /*if((replica.project.key == "AVNSTDG5" || replica.project.key == "AVNSTDG5H") && replica.type.name == "Bug"){ issue.projectKey = "MTCI153" }*/ if((replica.project.key == "AVNG5WIDE" || replica.project.key == "AVNG5WIDEH" || replica.project.key == "AVNSTDG5" || replica.project.key == "AVNSTDG5H") && (replica.type.name == "Bug_QC" || replica.type.name == "Bug")){ issue.projectKey = "MTCI153" } /*if(replica.project.key == "AVNG5WIDE" && (replica.type.name == "Bug_QC" || replica.type.name == "Bug")){ issue.projectKey = "MTCI153" } if(replica.project.key == "AVNG5WIDEH" && (replica.type.name == "Sub_task" || replica.type.name == "Bug_Qc" || replica.type.name == "Bug")){ issue.projectKey = "MTCI153" }*/ if(replica.project.key == "AUDD20V" && (replica.type.name == "Bug" || replica.type.name == "Bug_QC")){ issue.projectKey = "MTCI211" } if(replica.project.key == "AVNG5WIDEP" && (replica.type.name == "Bug" || replica.type.name == "Bug_QC")){ issue.projectKey = "MTCI204" } if((replica.project.key == "AVNSTDG6" || replica.project.key == "AVNG6YOC" || replica.project.key == "AVNG6HKMC" || replica.project.key == "IVI Module" || replica.project.key == "Broadcast" || replica.project.key == "Middleware") && (replica.type.name == "Bug" || replica.type.name == "Bug_QC")){ issue.projectKey = "MTCI246" } // Set type name from source issue, if not found set a default issue.typeName = "[MTCK_MTCI_01] SW Defect Management" } issue.summary = replica.summary issue.description = replica.description issue.assignee = nodeHelper.getUserByUsername(replica.assignee?.username) issue.labels = replica.labels //issue.mtckIssueId = replica.id issue.customFields."MTCK-IssueId".value = replica.id //issue.due = replica.due //issue.customFields."Temp Due Date".value = replica.due //issue.customFields."Commit".value = replica.customFields."Commit Availability?".value if (replica.customFields."Severity"?.value != null) { issue.customFields."MTCK-Severity".value = replica.customFields."Severity".value } issue.comments = commentHelper.mergeComments(issue, replica) issue.attachments = attachmentHelper.mergeAttachments(issue, replica) issue.changeHistory = replica.changeHistory if (replica.customFields."Start date"?.value != null) { issue.customFields."Start date".value = replica.customFields."Start date".value.getTime() + (5 * 60* 60 *1000) } if (replica.customFields."End date"?.value != null) { issue.customFields."End date".value = replica.customFields."End date".value.getTime() + (5 * 60* 60 *1000) } if (replica.due != null) { issue.customFields."IVI-MTCK-Due Date".value = replica.due.getTime() + (5 * 60* 60 *1000) } if (replica.labels != null) { issue."labels" = replica."labels" } if (replica.customFields."Reporter Center" != null) { issue.customFields."MTCK-Reporter Center".value = replica.customFields."Reporter Center".value } if (replica.customFields."Reporter Department" != null) { issue.customFields."MTCK-Reporter Department".value = replica.customFields."Reporter Department".value } if (replica.customFields."Milestone" != null) { issue.customFields."MTCK-Milestone".value = replica.customFields."Milestone".value } if (replica.customFields."OEM" != null) { issue.customFields."MTCK-OEM".value = replica.customFields."OEM".value } if (replica.customFields."Function Category" != null) { issue.customFields."MTCK-Function Category".value = replica.customFields."Function Category".value } if (replica.customFields."Platform Option" != null) { issue.customFields."MTCK-Platform Option".value = replica.customFields."Platform Option".value } if (replica.customFields."Prev SW Ver." != null) { issue.customFields."MTCK-Prev SW Ver".value = replica.customFields."Prev SW Ver.".value } if (replica.customFields."Assignee" != null) { issue.customFields."MTCK-Assignee".value = replica.assignee.username } if (replica.customFields."Related Item" != null) { issue.customFields."MTCK-Related Item".value = replica.customFields."Related Item".value } //issue.customfields."MTCK-Milestone".value = replica.customFields."Milestone" //issue.customFields."MTCK-Milestone".value = replica.customFields."Milestone".value if (replica.customFields."MTCK-Severity" != null) { issue.customFields."MTCK-Severity".value = replica.customFields."Severity"?.value } //issue.customFields."MTCK-Reporter Center".value = replica.customFields."Reporter Center".value if (replica.customFields."Bug Description" != null) { issue.customFields."Bug-Description".value = replica.customFields."Bug Description"?.value } if (replica.customFields."Region" != null) { issue.customFields."MTCK-Region".value = replica.customFields."Region"?.value } if (replica.customFields."Frequency" != null) { issue.customFields."MTCK-Frequency".value = replica.customFields."Frequency"?.value } //issue.customFields."MTCK-Reporter Department".value = replica.customFields."Reporter Department".value //issue.customFields."MTCK-OEM".value = replica.customFields."OEM".value.value //issue.customFields."MTCK-Function Category".value = replica.customFields."Function Category".value //issue.customFields."MTCK-Related Item".value = replica.customFields."Related Item".value if (replica.customFields."Vehicle Code" != null) { issue.customFields."MTCK-Vehicle Code".value = replica.customFields."Vehicle Code"?.value } //Remainig Fields issue.customFields."MTCK-Other Region".value = replica.customFields."Other Region"?.value issue.customFields."MTCK-Other Vehicle Code".value = replica.customFields."Other Vehicle Code"?.value if (replica.customFields."Prev SW Ver." != null) { issue.customFields."MTCK-Prev SW Ver".value = replica.customFields."Prev SW Ver.".value } //issue.customFields."MTCK-Prev SW Ver".value = replica.customFields."Prev SW Ver.".value issue.customFields."MTCK-New SW Ver".value = replica.customFields."New SW Ver."?.value issue.customFields."MTCK-Resolution Description".value = replica.customFields."Resolution Description"?.value //Number Fields issue.customFields."MTCK-Effort(MD)".value = replica.customFields."Effort(MD)"?.value issue.customFields."MTCK-Reopen Count".value = replica.customFields."Reopen Count"?.value issue.customFields."MTCK-Testability".value = replica.customFields."Testability"?.value //Coded Field. //issue.customFields."MTCK-Platform Option".value = replica.customFields."Platform Option".value.value //cascading field //issue.customFields."MTCK-Regular Update".value = replica.customFields."Regular Update".value.value //Other Details for Backup issue.customFields."MTCK-Assignee".value = replica.assignee?.username issue.assignee = nodeHelper.getUserByUsername(replica.assignee?.username) issue.customFields."MTCK-Bug Reporter".value = replica.reporter.displayName issue.customFields."MTCK-Issue Key".value = replica.key //issue.customFields."MTCK-Platform Option".value = replica.customFields."Platform Option".value.value //Date Field Sync //issue.customFields."Start date".value = replica.customFields."Start date".value //issue.customFields."End date".value = replica.customFields."End date".value //issue.due = replica.due if (issue.status?.name == "Opened" && replica.status.name == "Assigned") { workflowHelper.transition(issue, "Assigned") } if (issue.status?.name == "In Progress" && replica.status.name == "Resolved") { workflowHelper.transition(issue, "Resolved") } if (issue.status?.name == "Assigned" && replica.status.name == "In Progress") { workflowHelper.transition(issue, "In Progress") } if (issue.status?.name == "Resolved" && replica.status.name == "Closed") { workflowHelper.transition(issue, "Closed") } if (issue.status?.name == "Closed" && replica.status.name == "Resolved") { workflowHelper.transition(issue, "Resolved") } /*if (issue.status?.name == "In Progress" && replica.status.name == "In Review") { workflowHelper.transition(issue, "In Review") }*/ if (issue.status?.name == "In Review" && replica.status.name == "In Progress") { workflowHelper.transition(issue, "In Progress") } if (issue.status?.name == "In Review" && replica.status.name == "Resolved") { workflowHelper.transition(issue, "Resolved") } if (issue.status?.name == "POSTPONED" && replica.status.name == "Closed") { workflowHelper.transition(issue, "Closed") } if (issue.status?.name == "Resolved" && replica.status.name == "POSTPONED") { workflowHelper.transition(issue, "Postponed") } Status.receive(useRemoteStatusByDefault = true,workflowMapping = [ "Opened" : "Opened", "Assigned" : "Assigned", "In Progress" : "In Progress", //"In Review" : "In Review", "Resolved" : "Resolved", "Closed" : "Closed", "POSTPONED" : "POSTPONED", ], resolutionMapping = [:] )