1
0
-1

I need the Jira tickets assigned to different based on the Summary field coming from ADO. I tried the below script but it seems to have a syntax error and does not allow me to save. But hopefully, this will show you what I try to achieve.
I need this in Jira Cloud Incoming script.
------------------------------------------------------------------------------------------
def AssigneeSVT = nodeHelper.getUserByEmail("SVTEmail@abc.com.au")
def AssigneeSIT = nodeHelper.getUserByEmail("SITEmail@abc.com.au")
def AssigneeUAT = nodeHelper.getUserByEmail("UATEmail@abc.com.au")

if (replica.summary.substring(0,3) = "SVT") {
issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: AssigneeSVT
}

if (replica.summary.substring(0,3) = "SIT") {
issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: AssigneeSIT
}

if (replica.summary.substring(0,3) = "UAT") {
issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: AssigneeUAT
}

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi,

      Instead of "startsWith" can I use "contains"? Will it scan the string to find a spefic value. 

      I tried with

      if (replica.summary.contains("VCCT"))

      But it didnt work. 

      Appreciate any help on this.

      Thanks

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi you may try the following:

        def AssigneeSVT = nodeHelper.getUserByEmail("SVTEmail@abc.com.au")
        def AssigneeSIT = nodeHelper.getUserByEmail("SITEmail@abc.com.au")
        def AssigneeUAT = nodeHelper.getUserByEmail("UATEmail@abc.com.au")
        
        if (replica.summary.startsWith("SVT")) {
        issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: AssigneeSVT
        }
        
        if (replica.summary.startsWith("SIT")) {
        issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: AssigneeSIT
        }
        
        if (replica.summary.startsWith("UAT") {
        issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: AssigneeUAT
        }

        Kind regards,

        Ariel

        1. Chama

          Hi Ariel,

          Many thanks for your response. It worked!

          Regards


        2. Francis Martens (Exalate)

          Small nit
          You will perform 4 'getUserByEmail' this way while with following code, you only will perform 2 queries (max).  In case of performance concerns ...



          if (replica.summary.startsWith("SVT")) {
          issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: nodeHelper.getUserByEmail("SVTEmail@abc.com.au")
          }
          
          if (replica.summary.startsWith("SIT")) {
          issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: nodeHelper.getUserByEmail("SITEmail@abc.com.au")
          }
          
          if (replica.summary.startsWith("UAT") {
          issue.assignee = nodeHelper.getUserByEmail(replica.assignee?.email) ?: nodeHelper.getUserByEmail("UATEmail@abc.com.au")
          }
        3. Chama

          Sorry, meant to post this as an additional question, not an answer.


          Instead of "startsWith" can I use "contains"? Will it scan the string to find a spefic value. 

          I tried with

          if (replica.summary.contains("VCCT"))

          But it didnt work. 

          Appreciate any help on this.

          Thanks

        CommentAdd your comment...