Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,418
Community Members
 
Community Events
165
Community Groups

Format of a Date Picker Custom field in an Email post-function (ScriptRunner)

Edited

How to change the format of my Date Picker Custom field in my Email post-function please ?
I am using this in the Email template : 

<% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("DatePickerCustomFieldName")) %>

And I am getting this :

2018-04-23 00:00:00.0

I'd like to get :

23-04-2018

 Thank you for your help !

2 answers

1 accepted

Hi,

You could try:

issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("DatePickerCustomFieldName")).format("dd-MM-yyyy")

 

It's working fine for me, maybe it works for you too.

Regards,
Marcos

Thank you ! it works well

I get: 

No signature of method: com.atlassian.jira.issue.fields.ImmutableCustomField.format() is applicable for argument types: (java.lang.String) values: [dd-mm-yyyy]

def subTaskCustomField17127 = com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_17127")
def customFieldValue17127 = issue.getCustomFieldValue(subTaskCustomField17127.format("dd-mm-yyyy"))

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Improving the Create Issue Experience in Jira Service Management Cloud

Hello everyone!  We are very excited to announce some much needed changes to the issue create experience in JSM (the blue "create" button) at the top of the screen.  We have just starte...

149 views 7 4
Read article

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