Originally asked by Jose Pablo Alpizar Hidalgo on 25 May 2022 (original question)
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”)
Francis Martens (Exalate) commented on 31 May 2022
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")
}
Chama commented on 19 December 2022
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.