2
1
0

i am running a status sync mapping which looks like this,


if(replica.project.key == "SUP"){
issue.projectKey = "IPS"
issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Support Case"
// ["remote status name": "local status name"]
def statusMap = [
"Open": "Pending Support",
"In Progress": "Pending Support",
"Pending Plugin": "Pending Support",
"Pending R&D": "Pending Support",
"Pending PS": "Pending Support",
"Pending MA": "Pending Support",
"Pending Research": "Pending Support",
"Pending other" : "Pending Support",
"Pending QA" : "Pending Support",
"Back From Pending" : "Pending Support",
"Team Leader Review": "Pending Support",
"Done": "Back From Support",
"Rejected": "Back From Support"
]
def remoteStatusName = replica.status.name
issue.setStatus(statusMap[remoteStatusName] ?: remoteStatusName)
}


but the issue i am having is every time we sync anything between the tickets, the ststus mapping kicks in and changes the status on the other side even when i dont want it to

(lets say i only wanted to sync the Jira comments right now)

is there a way to map in such a way that only in certain statuses the status mapping kicks in, and in other situations not ?

right now this sync issue is creating a problems from the team

after the initial sync when the each ticket has a life cycle and workflow it goes through that is not always relevant for the other side,

but when i add a comment it sync the status again also in accordance to the mapping, which is at this point not relevant anymore


i hope that makes sense 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Ori Arbel 


      You can simply create an if statement like this

      if(!(replica.status.name == "To Do" || replica.status.name == "Open"))
      {
      	////Do status mapping + set status
      }


      Here you basically say, if the replica status is "To Do" or "Open", then you don't want to run the status mapping. But if they aren't (notice the ! at the beginning), then I want to run the status code.


      Hope it helps

      Kind regards

      Jorden

        CommentAdd your comment...
      1.  
        2
        1
        0

        Hi Jorden,


        worked like a charm

        thanks for the tip

        1. Jorden Van Bogaert

          Hi Ori Arbel 


          Awesome! Could you perhaps mark my answer as accepted?

          That'll help the community to know this is resolved and will allow other users to find this question easier.


          Have a great day!

          Kind regards

          Jorden

        CommentAdd your comment...