2
1
0

Hi, we try to sync issues from a public JIRA instance (we'll call it A) with a private JIRA datacenter instance (we'll call it B).
It basically works
We face an issue when we try to add "non bijective" statuses:
An issue is always opened on B. Status is "open" on both A and B.
status can change on A side while it does not have to change on B side. Basically 6 statuses on A side correspond to "Open" on B side
see attched screenshot of those 6 statuses.
To do so we used what we saw here:
https://docs.idalko.com/exalate/plugins/servlet/remotepageview?pageId=19629783#StatussynchronizationonJiraServer-statusSyncExternal

so on B side we set:
def statusMap = [

// "remote status name": "local status name"
"Open" : "Open",
"Selected For Development" : "Open",
"In Progress" : "Open",
"In Review" : "Open",
"In Testing" : "Open"
]
def remoteStatusName = replica.status.name
issue.setStatus(statusMap[remoteStatusName] ?: remoteStatusName)

Maybe we misunderstood something. because we get the attached error:

Support type

troubleshooting








    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      Sorry to bother, but I still  have no solution on this subject, can somebody please help?

        CommentAdd your comment...
      1.  
        1
        0
        -1

        tournier 

        Check the code fragment

        def statusMap = [
        
        // "remote status name": "local status name"
        "Open" : "Open",
        "Selected For Development" : "Open",
        "In Progress" : "Open",
        "In Review" : "Open",
        "In Testing" : "Open"
        ]
        def remoteStatusName = replica.status.name
        issue.setStatus(statusMap[remoteStatusName] ?: remoteStatusName)


        The remote status 'IN TESTING' is not in the statusMap, so the statement 'statusMap[remoteStatusName] ?: remoteStatusName' will resolve to 'IN TESTING'.

        Probably that status is not available in the workflow.
        Either add the status, or adapt the statusmap

        1. tournier

          Hi, thx for the answer.

          This is precisely the case, "IN TESTING" is not in the workflow of project B. This is why I called it "non-bijective", B does not want to know about statuses of tickets inside A workflow until it reaches a common status of both A and B projects, which is "resolved". Before being resolved, it is only seen as "OPEN" in B's workflow, while it goes from  "Selected For Development","In Progress","In Review" to "In Testing" in A's workflow.

          We can not change B's workflow as it is shared between several projects oj JIRA server.

          When you say "adapt status map" what do you mean?

          best regards

        2. tournier

          We tried another thing and there is no error anymore, but sync only works from B to A and not from A to B (any modification from B to A is taken into account, but status modification in A project is not seen in B project)


          Here is the script in A's exalate:


          OUTGOING


          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

          if ((issue.status == “RESOLVED” )||( issue.status == ”DELIVERED”) || (issue.status ==”VALIDATED”)||( issue.status ==”CLOSED”) || (issue.status ==”REJECTED”)|| (issue.status ==”DEFERRED”))

          {

             replica.status    =   issue.status

          }

          replica.parentId       = issue.parentId
          replica.priority       = issue.priority
          replica.attachments    = issue.attachments
          replica.project        = issue.project
          replica.fixVersions    = issue.fixVersions
          replica.affectedVersions = issue.affectedVersions// add by William
          replica.customFields.Severity  = issue.customFields.Severity //Comment these lines out if you are interested in sending the full list of versions and components of the source project.
          replica.project.versions = []
          replica.project.components = []/*
          Custom Fieldsreplica.customFields."CF Name" = issue.customFields."CF Name"
          */


          INCOMING


          if(firstSync){   issue.projectKey   = "BSFM2"
             // Set type name from source issue, if not found set a default
             issue.typeName     = nodeHelper.getIssueType(replica.typeName)?.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 ((issue.status != “Selected for development” )&&( issue.status != ”In Progress”) && (issue.status !=”In Stand By”)&&( issue.status !=”In Review”) && (issue.status !=”In testing”)

          {

          issue.status       = replica.status 
          }

          issue.customFields."Severity".value  = replica.customFields."Severity"?.value
          issue.customFields."Occurrence".value = replica.customFields."Occurrence"?.valueissue.fixVersions = replica
            .fixVersions
            // ensure that all the fixVersions are available on B
            .collect { v -> nodeHelper.createVersion(issue, v.name, v.description) }
          // assign affected versions from JIRA A to JIRA B
          issue.affectedVersions = replica
            .affectedVersions
            .collect { v -> nodeHelper.createVersion(issue, v.name, v.description) }





          In B exalate script is basically (regarding status only, I strip off all the rest of the script):


          OUTGOING


          replica.status         = issue.status


          INCOMING

          issue.status       = replica.status




          trig is on both sides defined for creation+update



          I really don't get why statuses are not synced from A to B and only work from B to A



        3. tournier

          For instance, comments are well synced in both ways, so issue is really only for statuses


        4. Francis Martens (Exalate)

          You have to come up with the logic to implement the bidirectional mapping.
          For instance if the status on B goes to 'In testing', then ignore the status sync on both ends ...


        CommentAdd your comment...
      2.  
        0
        -1
        -2

        Hi

        your status name are in Uppercase so you should modified their name in rule like that


        "OPEN" : "OPEN",

        "SELECTED FOR DEVELOPMENT" : "OPEN",

        "IN PROGRESS" : "OPEN",

        "IN REVIEW" : "OPEN",

        "IN TESTING" : "OPEN"


        hope to be helpful

        1. tournier

          it does not seam to be the issue here, Statuses don't seem to be case sensitive


        CommentAdd your comment...