Keep getting an error and I can't find the problem Edited



I keep getting an error in the post function "send custom email".

I have a complete html emailbody, with several standard and custom fields displayed for a customer when the transition takes place. This supposed be send to the customer, but for some reason it will not send out and keep having the same error while I didn't change anything in the email. 


The error I keep getting:

2017-11-01 11:03:45,876 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2017-11-01 11:03:45,876 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: TM-1225, actionId: 271, file: null
java.lang.NullPointerException: Cannot invoke method getName() on null object
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMail(SendCustomEmail.groovy:477)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMail$1.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMail$1.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMailWithConditionResult(SendCustomEmail.groovy:457)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMailWithConditionResult$0.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.doScript(SendCustomEmail.groovy:553)


The begin of the html body:
def cf_Company = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Company")
def cf_CompanyValue = issue.getCustomFieldValue(cf_Company)
def fixVersion = issue.getFixVersions()
def status = issue.getStatus().getName()
def resolution = issue.getResolution().getName()
def cf_Resolution = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Resolution text")
def cf_ResolutionText = issue.getCustomFieldValue(cf_Resolution)


If i look at the error lines, I can't see anything wrong.

 Also when i Press on the preview button, it does show all the info I need to see.

Working with Jira 7.3.8 and Scriptrunner 5.1.6

Can somebody help me out? I have tried multiple things but nothing is helping.

Thank you

2 answers

0 votes
Tarun Sapra Community Champion Nov 01, 2017

In your script you have the code snippet


Please change it to


ALso, where in the code are you using the "status" field variable "def status" which you are extracting as I don't see it being used at all in your code after being extracted from the issue object.

Hi Tarun,


I use the code here: <td style="font-size: 13px; line-height: 20px; font-family: Arial, sans-serif; color: #888888; font-weight: normal;"><span>$status</span></td>

We have a complete custom setup due to the standards of our company. It worked for a long time but since a few weeks i can't get it to work anymore.

I'm gonna try your solution, and will let you know if this worked after I tried. Thanks so far!

I had my hopes, but it's not working.


I have tried this to:

  •  $issue.status
  • ${issue.status}
  • ${status}

Hi @Tarun Sapra


I've checked my other custom emails, and all of them are working except this one, the all have the same issue fields that needs to be shown on the form.


I have found the problem!

As you can see at the head of my emailbody I have selection of fields that needs to be shown on the form when this is send by email.

For some reason def resolution = issue.getResolution().getName()  wouldn't get the the standard resolution out of the issue( in this case Unresolved) 

So what I did: I deleted this and the syntax in the form. And now it's working. I only needed the Resolution text to be visible for the customer.


@Tarun Sapra Thanks for the help and the little push! 


Kind regards Priscilla

Tarun Sapra Community Champion Nov 03, 2017

Good to hear that the problem is fixed now.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

441 views 8 26
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