xl8bot
November 4, 2024, 7:49am
1
Originally asked by Harold Oconitrillo on 11 May 2022 (original question)
Hello.
We are syncing a server project with multiple cloud project and would like to use component value from origin project to set destination project in cloud instance. i.e.
If origin component == Member, destination project == MPM
if origin component == Sales, destination project == SBA
etc.
I found some articles describing something similar, but the code described in those articles “works for local synchronization only”.
Is there a code that works for server-cloud synchronization?
Thank you.
xl8bot
November 4, 2024, 7:49am
2
Answer by Harold Oconitrillo on 17 May 2022
Hi Adrian,
Please try the following snippet into Jira Cloud incoming script:
if(firstSync){
//Member is Remote component name - MPM is Desired local project key
def componentNameToProjectMap = ["Member":"MPM", "Sales":"SBA"]
issue.projectKey = replica.components.collect { component -> componentNameToProjectMap[component.name] }.find{it != null} ?: "MPM"
//?: "MPM" Refers to default project if not found
issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
}
Kind regards,
Harold
xl8bot
November 4, 2024, 7:49am
3
Answer by adrian s on 12 May 2022
Harold Oconitrillo documentation https://docs.idalko.com/exalate/x/4wB1Aw covers “How to sync components in Jira on-premise”. What we need is to use the component value coming from the source side to select/set the destination project value. The document i found https://docs.idalko.com/exalate/display/ED/How+to+set+the+project+based+on+the+source+issue+custom+field+value shows how we can set the project based on the source issue custom field value but the code “works for local synchronization only” and our synchronization is between one server project and multiple cloud projects.
Thanks.
Adrian
xl8bot
November 4, 2024, 7:49am
4
Answer by Harold Oconitrillo on 11 May 2022
Hi,
Certainly, you may review the below documentation
https://docs.idalko.com/exalate/x/4wB1Aw
Kind regards,
Harold Cruz