JIRA Workflow Post Function Custom Script to send email fails

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 vote
Steven Behnke Community Champion Oct 21, 2016

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

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 vote
Steven Behnke Community Champion Oct 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!

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

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).

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Mission-critical battery manufacturer fulfills FAA software requirements with Commit Policy Plugin

EaglePicher Technologies is a leading manufacturer of battery systems for diverse industries like defense, aviation, space or medical. As they operate in highly regulated industries, keeping a clear ...

176 views 0 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you