JIRA Workflow Post Function Custom Script to send email fails

Karanpreet Kaur 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

0 votes
Karanpreet Kaur 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 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 Leaders.
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 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 Leaders.
October 21, 2016

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

Suggest an answer

Log in or Sign up to answer