# Setting a project based on the source issue custom field value for server-cloud synchronization

**URL:** <https://community.exalate.com/t/setting-a-project-based-on-the-source-issue-custom-field-value-for-server-cloud-synchronization/5206>\
**Category:** General Questions\
**Tags:** exalate, jira-cloud, jiraserver, migrated\_question\
**Created:** [November 4, 2024, 7:49am UTC](https://community.exalate.com/t/setting-a-project-based-on-the-source-issue-custom-field-value-for-server-cloud-synchronization/5206 "2024-11-04T07:49:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:49am UTC](https://community.exalate.com/t/setting-a-project-based-on-the-source-issue-custom-field-value-for-server-cloud-synchronization/5206/1 "2024-11-04T07:49:54Z")

</div>

_Originally asked by Harold Oconitrillo on 11 May 2022 [(original question)](https://oldcommunity.exalate.com/questions/42838101)_

* * *

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.

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:49am UTC](https://community.exalate.com/t/setting-a-project-based-on-the-source-issue-custom-field-value-for-server-cloud-synchronization/5206/2 "2024-11-04T07:49:55Z")

</div>

_Answer by Harold Oconitrillo on 17 May 2022_

Hi Adrian,

Please try the following snippet into Jira Cloud incoming script:

```auto
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

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:49am UTC](https://community.exalate.com/t/setting-a-project-based-on-the-source-issue-custom-field-value-for-server-cloud-synchronization/5206/3 "2024-11-04T07:49:56Z")

</div>

_Answer by adrian s on 12 May 2022_

Harold Oconitrillo documentation [https://docs.idalko.com/exalate/x/4wB1Aw](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](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

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:49am UTC](https://community.exalate.com/t/setting-a-project-based-on-the-source-issue-custom-field-value-for-server-cloud-synchronization/5206/4 "2024-11-04T07:49:56Z")

</div>

_Answer by Harold Oconitrillo on 11 May 2022_

Hi,

Certainly, you may review the below documentation

[https://docs.idalko.com/exalate/x/4wB1Aw](https://docs.idalko.com/exalate/x/4wB1Aw)

Kind regards,

Harold Cruz

* * *
