1
0
-1

Hi Team,


I have tried to sync the destination key back to source issue with below codes, but it seems it sync back some other fields also. please help on how to sync only back destination key while first sync.


Incoming sync (destination side)


1
2
3

if(firstSync){
  syncHelper.syncBackAfterProcessing()

Incoming sync (source side)


1

issue.customFields."remote issue key".value = replica.key



Regards,

Moogambigai G R

  1. Moogambigai G R

    I have added incoming destination and source side.

    Here I get the destination key in "OEM Sync ID" text field.

    Destination:
    
    
    if(replica.project.key == "DAR" && replica.type.name == "Defect") //sync A -> B
    {
      issue.projectKey   = "OEM"
      def issueTypeMapping = [
      "Defect" : "Acquired Product Defect"
    ]
     
    issue.typeName = issueTypeMapping[replica.type?.name] ?: "Acquired Product Defect"
      
      issue."17402" = replica."11030" //Defect Change Type//OEM Defect Change Type
      issue."17404" = replica."10113" //Customer Severity//OEM Customer Severity
      issue."17405" = replica."10115" //Repeatability//OEM Repeatability
      issue."17412" = replica."10116" //Recovery//OEM Recovery
      issue."17434" = replica."12009" //Is Waiver//OEM Is Waiver
      issue."17406" = replica."10804" //Is Barrier to Test//OEM Is Barrier to Test
      issue."17432" = replica."10120" //Review Forum//OEM Review Forum
      issue."17446" = replica."10119" //Review Status//OEM Review Status
      issue."17426" = replica."11221" //Raised SW Set (Branch Id)//OEM Raised SW Set (Branch Id)
      issue."17427" = replica."11222" //Raised SW Set (Build)//OEM Raised SW Set (Build)
      issue."17425" = replica."11220" //Raised SW Set (Product Id) // OEM Raised SW Set (Product Id)
      issue."17424" = replica."11216" //Raised SW Set (Major Build)//OEM Raised SW Set (Major Build)
      issue."17430" = replica."11406" //SW Last Found In (Branch Id) // OEM SW Last Found In (Branch Id)
      issue."17431" = replica."11407" //SW Last Found In (Build) // OEM SW Last Found In (Build)
      issue."17428" = replica."11404" //SW Last Found In (Major Build)//OEM SW Last Found In (Major Build)
      issue."17429" = replica."11405" //SW Last Found In (Product Id)//OEM SW Last Found In (Product Id)
      issue."17502" = replica."17502" //Component SW Version
      issue."17410" = replica."11226" //Feature// OEM Feature
      issue."17420" = replica."11306" //Test Found In//OEM Test Found In
      issue."17413" = replica."10117" //Is a Regression //OEM Is a Regression
      issue."17800" = replica."10411" //APF //OEM APF
      issue."17801" = replica."10442" //Backlog Priority// OEM Backlog Priority
      
        
      //issue."17400" = replica."10706" //Program/Product//OEM Program/Product
      //issue."17401" = replica."10134" //Affected programs//OEM Affected programs
      
      //issue."17400" = "Alexandra" //Program/Product//OEM Program/Product
      issue."17401" = "Alexandra" //Affected programs//OEM Affected programs
      
    if (issue.projectKey == "OEM") //Program/Product//OEM Program/Product
    {
             def aTeam = replica."10706"?.value 
             if ((aTeam != "Alexandra") && (aTeam != "Canyon")&&(aTeam != "Carroll") && (aTeam != "Carroll-Ref")&&(aTeam != "Lexmark") && (aTeam != "Melody")&& (aTeam != "Mystic"))
        	  {
        	      issue.customFields."17400"?.value = "Alexandra"
        	  }
        	  else 
        	  {
        	  issue.customFields."17400".value = replica.customFields."10706".value
        	  }
    }  
      
      
    if (issue.projectKey == "OEM") //Accountable Team//OEM Accountable Team
    {
             def aTeam = replica."10806"?.value 
         	  if (aTeam != "Lexmark")
        	  {
        	      issue.customFields."17500"?.value = "Discovery"
        	  }
        	  else 
        	  {
        	  issue.customFields."17500".value = replica.customFields."10806".value
        	  }
    }
    
    issue.summary      = replica.summary
    issue.description  = replica.description
    issue.comments     = commentHelper.mergeComments(issue, replica)
    issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
    issue.labels       = replica.labels
    issue.assignee     = replica.assignee
    issue.reporter     = replica.reporter
    
    issue.resolution   = replica.resolution
    issue.status       = replica.status
    issue.priority     = replica.priority
    issue.key          = replica.key
    //issue.type         = replica.type
    //issue.project      = replica.project  
    issue.customFields."DAR Sync ID".value = replica.key
    
    if(firstSync){
      syncHelper.syncBackAfterProcessing()
    } 
    
    
    }
    
    
    
    Source:
    
    
    else if(replica.project.key == "OEM" && replica.type.name == "Acquired Product Defect")  { 
    //sync B -> A
     issue.projectKey   = "DAR"
      
      def issueTypeMapping = [
      "Acquired Product Defect" : "Defect"
    ]
     
    issue.typeName = issueTypeMapping[replica.type?.name] ?: "Defect"
    
    
    
     
    
      issue."11030" = replica."17402" //Defect Change Type//OEM Defect Change Type
      issue."10113" = replica."17404" //Customer Severity//OEM Customer Severity
      issue."10115" = replica."17405" //Repeatability//OEM Repeatability
      issue."10116" = replica."17412" //Recovery//OEM Recovery
      issue."12009" = replica."17434" //Is Waiver//OEM Is Waiver
      issue."10804" = replica."17406" //Is Barrier to Test//OEM Is Barrier to Test
      issue."10120" = replica."17432" //Review Forum//OEM Review Forum
      issue."10119" = replica."17446" //Review Status//OEM Review Status
      issue."11221" = replica."17426" //Raised SW Set (Branch Id)//OEM Raised SW Set (Branch Id)
      issue."11222" = replica."17427" //Raised SW Set (Build)//OEM Raised SW Set (Build)
      issue."11220" = replica."17425" //Raised SW Set (Product Id) // OEM Raised SW Set (Product Id)
      issue."11216" = replica."17424" //Raised SW Set (Major Build)//OEM Raised SW Set (Major Build)
      issue."11406" = replica."17430" //SW Last Found In (Branch Id) // OEM SW Last Found In (Branch Id)
      issue."11407" = replica."17431" //SW Last Found In (Build) // OEM SW Last Found In (Build)
      issue."11404" = replica."17428" //SW Last Found In (Major Build)//OEM SW Last Found In (Major Build)
      issue."11405" = replica."17429" //SW Last Found In (Product Id)//OEM SW Last Found In (Product Id)
      issue."17502" = replica."17502" //Component SW Version
      issue."11226" = replica."17410" //Feature// OEM Feature
      issue."11306" = replica."17420" //Test Found In//OEM Test Found In
      //issue."10706" = replica."17400" //Program/Product//OEM Program/Product
      //issue."10134" = replica."17401" //Affected programs//OEM Affected programs
      issue."12007" = "No" //Platform Common
      issue."12008" = "No" //Translation Impacts
      issue."11000" = "No" //Affects PLQA Tests
      issue."11002" = "No" //Affected PLQA Tests are tested earlier
      issue."13504" = "No" //Triage Pattern
      issue."10116" = "No" //Recovery
      issue."12004" = "No" //Performance
      issue."12005" = "No" //Security Must Have
      issue."14400" = "No" //EIP/ Solution Impact
      issue."12001" = "No" //Job Integrity
      issue."12000" = "No" //Certifications
      issue."12002" = "No" //Lockup
      issue."12003" = "No" //Manufacturing Must Have
      
      issue."10706" = "Alexandra" //Program/Product//OEM Program/Product
      issue."10134" = "Alexandra" //Affected programs//OEM Affected programs
      
      issue."10411" = replica."17800" //APF //OEM APF
      issue."10442" = replica."17801" //Backlog Priority// OEM Backlog Priority
      
      issue."10806"= replica."17500"//Accountable Team//OEM Accountable Team
      
      issue.customFields."OEM Sync ID".value = replica.key
    
      
    
       
    issue.summary      = replica.summary
    issue.description  = replica.description
    issue.comments     = commentHelper.mergeComments(issue, replica)
    issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)
    issue.labels       = replica.labels
    
    issue.assignee       = replica.assignee
    issue.reporter       = replica.reporter
    
    issue.resolution     = replica.resolution
    issue.status         = replica.status
    issue.priority       = replica.priority
    
    issue.key          = replica.key
    //issue.type         = replica.type
    //issue.project      = replica.project
    
    
    }
  2. Moogambigai G R

    Hi there,


    Is there any update on my question?


    Regards,

    Moogambigai G R

  3. Moogambigai G R

    Hi there,


    Is there any update on my question?


    Regards,

    Moogambigai G R



  4. Moogambigai G R

    Hi There,


    Is there any update?


    Regards,

    Moogambigai G R

  5. Andres Martynowicz

    Hi, I can see on your incoming script that there are lot fields being impacted and it is expected to see changes on it.

    For example:

      issue."11030" = replica."17402" //Defect Change Type//OEM Defect Change Type
      issue."10113" = replica."17404" //Customer Severity//OEM Customer Severity
      issue."10115" = replica."17405" //Repeatability//OEM Repeatability
      issue."10116" = replica."17412" //Recovery//OEM Recovery

    I have tried the following on my two cloud instances and worked.

    Incoming sync (destination side)


    if(firstSync){
      syncHelper.syncBackAfterProcessing()


    Incoming sync (source side)


    issue.customFields."remote issue key".value = replica.key

    Would you be able to clarify your use case?


  6. Moogambigai G R

    Hi Andres,


    We are sync two projects in same instance, its a two way sync.

    Whenever Project A is synced to Project B, destination project B key should show in one of the customfield in Project A or in Project A JQL result 

CommentAdd your comment...