- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 07:44 AM
Hi,
I have a date field in the form (date_birth) which is in YYYY/MM/DD format.
I want this to be changed to DD/MM/YYY format in an email notification.
Can someone please help me with the mail script. One I created doesn't render the desired result.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 10:53 AM
@Thomas99 Here is my testing result, i have tested on my personal instance.
Attached screenshot for your reference, it working perfectly at my end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 11:57 AM
It worked!
I had to change gdt1.setDisplayValue(current.variables.date_of_birth); // Add your field Name
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 08:22 AM
@Thomas99 Here is an example mail script using which you can achieve the same result. Following script works on an HR Case. Please change it according to the DOB field on your current record.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var dob = current.subject_person_hr_profile.date_of_birth.getDisplayValue();
var dobArray = dob.split('/');
var newDob = dobArray[2]+'/'+dobArray[1]+'/'+dobArray[0];
template.print('old DOB '+ dob);
template.print('new DOB '+newDob);
})(current, template, email, email_action, event);