It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to change system field Due Date format in custom emails script runner? Edited

Hello All,

I am trying to correct date format in custom email. I am using below script in the Email template:

Due Date: $issue.dueDate

I am getting this:

Due Date: 2019-09-09 00:00:00.0

I want Just Date like below:

Due Date: 2019-09-09

I with the below scripts none of them is working:

${issue.dueDate().format('yyyy/MM/dd')}

${issue.dueDate().format("dd-MM-yyyy")}

Any help would be greatly appreciated.

Thanks in Advance,

Manikanta

2 answers

Hi mani@123 

try $issue.dueDate.format('dd-MM-yyyy')

or

$issue.getDueDate().format('dd-MM-yyyy')

Best

Tuncay Senturk

Hi Tuncay,

Thanks for the reply.

Both the scripts didn't worked. Below is the error in logs for both scripts.

$issue.dueDate.format('dd-MM-yyyy')

groovy.lang.MissingPropertyException: No such property: format for class: java.sql.Timestamp
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMail(AbstractSendCustomEmail.groovy:258)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.super$2$constructMail(SendCustomEmail.groovy)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMail(SendCustomEmail.groovy:208)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMail$1.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMailWithConditionResult(AbstractSendCustomEmail.groovy:246)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.super$2$constructMailWithConditionResult(SendCustomEmail.groovy)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMailWithConditionResult(SendCustomEmail.groovy:190)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMailWithConditionResult.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.doScript(SendCustomEmail.groovy:157)
Cancel

 

For this $issue.getDueDate().format('dd-MM-yyyy')

groovy.lang.MissingPropertyException: No such property: getDueDate for class: com.atlassian.jira.issue.IssueImpl
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMail(AbstractSendCustomEmail.groovy:258)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.super$2$constructMail(SendCustomEmail.groovy)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMail(SendCustomEmail.groovy:208)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMail$1.callCurrent(Unknown Source)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMailWithConditionResult(AbstractSendCustomEmail.groovy:246)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.super$2$constructMailWithConditionResult(SendCustomEmail.groovy)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMailWithConditionResult(SendCustomEmail.groovy:190)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMailWithConditionResult.callCurrent(Unknown Source)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.doScript(SendCustomEmail.groovy:157)

 

Thanks in advance,

Mani

This one?

 new Date($issue.dueDate).format('dd-MM-yyyy')

Sorry I didn't try before sending.

It is not working as expected. Output is like below:

Due Date: (2019-09-17 00:00:00.0).format('dd-MM-yyyy')

I tried with the below script it worked.

${(issue.dueDate).format('dd-MM-yyyy')}

Thanks a lot for your help!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

275 views 1 2
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you