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

This widget could not be displayed.
Steven Behnke Community Champion Oct 21, 2016

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

This widget could not be displayed.

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

This widget could not be displayed.
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!

This widget could not be displayed.

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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

155 views 2 0
Join discussion

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