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
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mani@123
try $issue.dueDate.format('dd-MM-yyyy')
or
$issue.getDueDate().format('dd-MM-yyyy')
Best
Tuncay Senturk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.