Send email based on Custom Field ID

Deleted user July 29, 2013

I want to be able to have a number of check boxes within the Issue create page, with these to include what teams will need to be involed with this issue;

Teams Involved:

Team1
Team2
Team3
Team4

So when the issue is created, if any of those checkboxes have been checked an email is sent to that team in addition. I tried using the builtin script runner but I wasn't able to get this working, I know the custom field ID of the Teams Involved field, I just need help creating the script to run this.

Thanks

1 answer

1 accepted

0 votes
Answer accepted
Eva
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.
July 29, 2013

I assume you have seen this.

So I am guessing you have problems with condition then?

So wouldnt it be:

cfValues["Team Name:"]?.getValue() != "Team1"

Hope this helps

Deleted user July 30, 2013

Ok, so my settings are as follows:

Builtin Script Runner - Send a custom email

Condition: cfValues["Teams Involved:"]?.getValue() != "Team1"

Result: java.lang.NullPointerException: Cannot invoke method getId() on null object

 
Eva
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.
July 30, 2013

Forgot that checkbox is different, Jamie has answered pretty well in here

Also to note that the condition should be TRUE to make the script to run (like running email) so in your example, any name other than Team1 would send the email.

Hope this helps!

Deleted user August 4, 2013

So I've set this up as suggested, and when I select Preview I get the following;

Condition The condition evaluated to true (note that for listeners the condition can't normally be tested)

Then I select Run and I get the following;

Result: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.atlassian.jira.event.issue.IssueEvent@7ab5f6cf[issue=IS-3753,comment=<null>,worklog=<null>,changelog=<null>,eventTypeId=1,sendMail=true,params={},subtasksUpdated=false]' with class 'java.lang.String' to class 'com.atlassian.jira.event.issue.IssueEvent'

Where IS-3753 is the test ticket, for which the value of the condition is true.

Deleted user August 4, 2013

So I've set this up as suggested, and when I select Preview I get the following;

Condition The condition evaluated to true (note that for listeners the condition can't normally be tested)

Then I select Run and I get the following;

Result: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.atlassian.jira.event.issue.IssueEvent@7ab5f6cf[issue=IS-3753,comment=<null>,worklog=<null>,changelog=<null>,eventTypeId=1,sendMail=true,params={},subtasksUpdated=false]' with class 'java.lang.String' to class 'com.atlassian.jira.event.issue.IssueEvent'

Where IS-3753 is the test ticket, for which the value of the condition is true.

Eva
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.
August 11, 2013

do you have screenshot? i t seems like you are adding another code fro issue event?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events