# How can i make rule condition for specific components

**URL:** <https://community.exalate.com/t/how-can-i-make-rule-condition-for-specific-components/4533>\
**Category:** General Questions\
**Tags:** exalate, migrated\_question, components\
**Created:** [November 4, 2024, 7:04am UTC](https://community.exalate.com/t/how-can-i-make-rule-condition-for-specific-components/4533 "2024-11-04T07:04:40Z")\
**Posts on this page:** 2\
**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:04am UTC](https://community.exalate.com/t/how-can-i-make-rule-condition-for-specific-components/4533/1 "2024-11-04T07:04:40Z")

</div>

_Originally asked by Salma Nairi on 04 January 2021 [(original question)](https://oldcommunity.exalate.com/questions/20123820)_

* * *

Hi

How can i get liste of remonte component to make make rules condition

for example : if component in ( comp1,comp2,comp3)

issue.projectkey=projet1

else

issue.projectkey=projet2

* * *

---

<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:04am UTC](https://community.exalate.com/t/how-can-i-make-rule-condition-for-specific-components/4533/2 "2024-11-04T07:04:41Z")

</div>

_Answer by Serhiy Onyshchenko on 04 January 2021_

Hello, Salma Nairi  
Could I ask you to try:

```auto
if( replica
    .components
    .name
    .any { remoteComponentName -> 
      ["comp1", "comp2", "comp3"].any{ it.equalsIgnoreCase(remoteComponentName)}  
    }) { issue.projectKey="projet1"
} else { issue.projectKey="projet2"}

```

Please, let me know, how it goes.

* * *

#### Comments:

> **Salma Nairi commented on 05 January 2021**
>
> > Hi Serhiy,
> 
> i tried this code but got an error : product key was not set
> 
> ### Error Creation Time:
> 
> 2021-01-05 09:33:47.347
> 
> ### Error Detail Message:
> 
> Project key was not set. Please check your create processor script.
> 
> ### Error Stack Trace
> 
> com.exalate.api.exception.IssueTrackerException: _ **Project key was not set. Please check your create processor script.** _ at com.exalate.node.hubobject.v1\_4.NodeHubIssueHelper.createIssue(NodeHubIssueHelper.java:493) at com.exalate.node.hubobject.v1\_4.NodeHubIssueHelper.createIssueWith(NodeHubIssueHelper.java:458) at
> 
> This my example:
> 
> if(firstSync){
> 
> if( replica
> 
> .components
> 
> .name
> 
> .any { remoteComponentName -\>
> 
> [“WIFI”,“WAN”].any{ it.equalsIgnoreCase(remoteComponentName)} })
> 
> { issue.projectKey=“NJJ”}
> 
> if( replica
> 
> .components
> 
> .name
> 
> .any { remoteComponentName -\>
> 
> [“GUI”].any{ it.equalsIgnoreCase(remoteComponentName)}
> 
> }) { issue.projectKey=“TGS”
> 
> }
> 
> Thanks a lot

> **Salma Nairi commented on 07 January 2021**
>
> > any update please ?

> **Francis Martens (Exalate) commented on 24 January 2021**
>
> > Looks like the logic to select the projectKey is not working as expected.
> 
> You can ensure that there is a default projectKey set before you try to set it based on the remoteComponentName
> 
> something like
> 
> ```auto
> if (firstSync) {
> issue.projectKey = "DEFAULT"
> ...
> 
> }
> 
> ```
> 
> That way you capture the fact that the projectKey has a value, even when there is no match.
