Jira on premise - local connection with one way comments

Originally asked by Brad Marsh on 25 September 2023 (original question)


HI Guys,
I am aware in a Jira to Jira sync (local to remote) how I can make a comment or other fields one way as you have a connection at each end scripted mode. In local mode Jira project A to Project b (Same Jira instance, just different projects) you have a single scripted connection. I am looking for JIRA A not to send any comments and for JIRA B to send all of its comments.

I have only been able to establish off or on.

Here is the config I have:

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
replica.status = issue.status
replica.parentId = issue.parentId
replica.priority = issue.priority
replica.attachments = issue.attachments
replica.project = issue.project



//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 = []



Incoming

   if(firstSync && replica.project.key == "ProjectB"){
      issue.projectKey   = "ProjectA"
      issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
   }
   if(firstSync && replica.project.key == "ProjectA"){
      issue.projectKey   = "ProjectB"
      issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
   }

   issue.status = replica.status
   issue.priority = nodeHelper.getPriority(replica.priority?.name, issue)
   issue.summary = replica.summary
   issue.description = replica.description
   issue.comments = commentHelper.mergeComments(issue, replica)
   issue.attachments = attachmentHelper.mergeAttachments(issue, replica)
   issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email)
   issue.reporter = nodeHelper.getUserByEmail(replica.reporter?.email)

  
 

Comments:

Stéphane Thillay commented on 25 September 2023

Hi Brad,

If you can distinguish the target project then you might put the issue.comments = ... line behind a check on what is the project. Doing so, only the wanted project would get (would take care of) the comments.

Comments would be “outgoing” all the time but ignored only for project B.

Regards,

Stéphane

Answer by Brad Marsh on 25 September 2023

I resolved this through a simple if statement in the incoming and uncommented the outgoing

  if(replica.project.key == "PROJECTB"){
      issue.comments = commentHelper.mergeComments(issue, replica)
   }



Comments:

Tomas Eduardo Lalanne commented on 28 September 2023

We are glad, that you were able to resolve it and if further assistance is needed please feel free to contact us once again.

BR

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.