The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA Workflow Post Function Custom Script to send email fails

Karanpreet Kaur
Contributor
October 21, 2016

Hi All,

Suddenly, our custom email script for workflow transition has started failing with the below error.


Time (on server): Fri Oct 21 2016 12:08:45 GMT-0400 (EDT)The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.2016-10-21 12:08:45,058 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************2016-10-21 12:08:45,066 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: nulljava.lang.NullPointerExceptionat com.atlassian.jira.issue.managers.DefaultIssueManager.getEntitiesByIssue(DefaultIssueManager.java:395)at com.atlassian.jira.issue.managers.DefaultIssueManager.getEntitiesByIssueObject(DefaultIssueManager.java:410)at com.atlassian.jira.issue.comments.CommentSearchManager.getComments(CommentSearchManager.java:102)at com.atlassian.jira.issue.comments.DefaultCommentManager.getComments(DefaultCommentManager.java:165)at com.atlassian.jira.issue.comments.CommentManager$getComments$1.call(Unknown Source)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.mergeEmailTemplate(SendCustomEmail.groovy:844)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.mergeEmailTemplateBody(SendCustomEmail.groovy:816)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$mergeEmailTemplateBody$2.callCurrent(Unknown Source)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMail(SendCustomEmail.groovy:367)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMail$7.callCurrent(Unknown Source)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMailWithConditionResult(SendCustomEmail.groovy:348)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMailWithConditionResult$6.callCurrent(Unknown Source)at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.doScript(SendCustomEmail.groovy:445)


We havent changed anything in our environment, and it just stopped working. Our users get notified of the change requests using this and this automation is critical for us to work. Any suggestions on how to fix it ?


Thanks,

Karan

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Karanpreet Kaur
Contributor
October 25, 2016

The issue was resolved by moving the custom email post function to the last position in the workflow transition post functions list (under all the default functions).

0 votes
Karanpreet Kaur
Contributor
October 25, 2016

Hi Steven,

It used to work fine for us as well as the first post function on the list, but it stopped working sometime back. We are not sure what broke it - may be the upgrade to Scriptrunner.

Thanks,

Karan

0 votes
Steven F Behnke
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 Champions.
October 24, 2016

Thanks for replying back the fix! I have always placed my own Send Email Post-Functions at the bottom, since that's where other events are. I'm not too sure what could cause this though!

0 votes
Karanpreet Kaur
Contributor
October 23, 2016

Hi Steven,

 

Thank you for getting back. The issue was resolved by moving the custom email post function to the last positions in workflow transition post functions list (under all the default functions).

0 votes
Steven F Behnke
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 Champions.
October 21, 2016

Can you post the script? A NPE implies you're performing actions on null data/fields.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.