Use component name in source JIRA as project name in target JIRA

Originally asked by Sam on 02 December 2020 (original question)


We are using Exalate to synchronize projects between two JIRA instances (Internal & partners).

We have a project for each partner in JIRA partner, so the project name on internal JIRA is synced as component name in partner JIRA.

So partner A has issue and they component of the issue reflect the project name in internal JIRA.

I have a case now where the partner would create an issue in JIRA partner, and that has to be synchronized to a project in internal Jira based on teh component name of the issue in Partners Jira. how can I do that please ?


Comments:

Sam commented on 02 December 2020

can someone help please ?

Answer by Sam on 06 December 2020

Hi André,

Would you be able to help me on the link I shared please ? or shall I open a new discussion ?


Answer by André Leroy-Beaulieu Castro on 02 December 2020

Hi Sam,

Here’s a solution for you, of course you’ll have to change the componentNameToProjectMap values from the component name on the external jiras to the project keys of the internal jira:

if(firstSync){
    def componentNameToProjectMap = ["Test component":"TEST","Test component 2":"TEST2"]
   issue.projectKey   = replica.components.collect { component -> componentNameToProjectMap[component.name] }.find{it != null} ?: "TEST"
   // Set type name from source issue, if not found set a default
   issue.typeName     = nodeHelper.getIssueType(replica.typeName)?.name ?: "Task"
}

Let me know if this works for you!

Best regards,

André


Comments:

Sam commented on 03 December 2020

Thanks André

It works … I am just missing the component and I pasted the question below:

Sync value in custom field with component/s field - Exalate - community