2
1
0

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


    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hello, Salma Nairi
      Could I ask you to try:

      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.

      1. Salma Nairi

        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



      2. Salma Nairi

        any update please ?

      3. Francis Martens (Exalate)

        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


        if (firstSync) {
           issue.projectKey = "DEFAULT"
           ...
        
        }



        That way you capture the fact that the projectKey has a value, even when there is no match.

      CommentAdd your comment...