Hi!
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:
<html>
<head>
<%
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)
%>
</head>
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
Hi!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In your script you have the code snippet
issue.getStatus().getName()
Please change it to
issue.getStatus().getSimpleStatus().getName()
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had my hopes, but it's not working.
I have tried this to:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.