Workflow Post Function: Script workflow function : Send an email based on the provided template

Ken October 25, 2019

Hi Atlassian Community,

 

I have the following condition for a script post function (send a custom email) configured:

 

(issue.getSummary().find('STRING1') || issue.componentObjects*.name.contains('STRING1')) && !(issue.reporter?.displayName.equals('Standby')) 

 

I would also like to add a description field check when STRING2 is also included in the issue description (AND). I tried adding "&& (issue.getDescription().find('STRING2')" but this did not work and threw an groovy error during the custom mail preview.

 

Thank you for your assistance.

 

Regards

 

 

2 answers

1 accepted

0 votes
Answer accepted
Aleksandr Zuevich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 25, 2019

Hi @Ken ,

It seems that you just forgot closing brace. This should work:

(issue.getSummary().find('STRING1') || issue.componentObjects*.name.contains('STRING1')) && !(issue.reporter?.displayName.equals('Standby')) && (issue.getDescription().find('STRING2')) 
0 votes
Ken October 25, 2019

Hi @Aleksandr Zuevich 

 

thank you very much. I will try this out. Another question:

 

If i wanted to add an additional STRING3 to be compared if either STRING2 OR STRING3 exists, could i do it like this:

(issue.getSummary().find('STRING1') || issue.componentObjects*.name.contains('STRING1')) && !(issue.reporter?.displayName.equals('Standby')) && (issue.getDescription().find('STRING2')) || (issue.getDescription().find('STRING3')) 

 

Or could I do it all in one check like this: issue.getDescription().find('STRING2','STRING3'))

Aleksandr Zuevich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 25, 2019

I'm not a groovy expert but I think you need

(issue.getSummary().find('STRING1') || issue.componentObjects*.name.contains('STRING1')) && !(issue.reporter?.displayName.equals('Standby')) && (issue.getDescription().find('STRING2') || (issue.getDescription().find('STRING3')))

Suggest an answer

Log in or Sign up to answer