Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Priscilla Reeders November 1, 2017

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

2 answers

0 votes
Priscilla Reeders November 2, 2017

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

Tarun Sapra
Community Champion
November 3, 2017

Good to hear that the problem is fixed now.

0 votes
Tarun Sapra
Community Champion
November 1, 2017

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.

Priscilla Reeders November 1, 2017

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!

Priscilla Reeders November 1, 2017

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

 

I have tried this to:

  •  $issue.status
  • ${issue.status}
  • ${status}
Priscilla Reeders November 1, 2017

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events