- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 10:49 AM
Hi @shivatmika_19,
I have written code and added below code to calculate years.
It is not working.
Please find attached screenshot :
Please help me to correct that.
Regards,
Nivedita
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 06:18 AM
@niveditakumari
Please use the following content:
Congratulations on ${mail_script:yearsOfWorking} Amazing Years, ${first_name} ${last_name}
Dear ${first_name} ${last_name},
Today marks a special milestone for ${first_name} ${last_name}'s ${mail_script:yearsOfWorking}-year work anniversary at ACME South America! Over the years, ${first_name} ${last_name} has consistently contributed their qualities/skills to our team.
From leading successful projects in department Product Management to mentoring new team members, ${first_name} ${last_name} has been an invaluable part of our journey." Your commitment and hard work have made a lasting impact, and we're so grateful to have you as part of our ACME South America family.
Let's all take a moment to congratulate ${first_name} ${last_name} and celebrate their incredible journey with us. Here's to many more successful years together!
Thank you for being an inspiration and for all the contributions you've made. Happy Work Anniversary, ${first_name} ${last_name}!
Signature:
Aruna,
Human Resource Manager.I believe I've addressed all of your questions. If you're satisfied with the solution, kindly click the thumbs up and accept my answer to close this thread.
Thanks & Best regards,
Medi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 09:44 AM
If you are using DateTime field please adjust the script as follow:
var hiringDate = current.u_hr_hire_date;
var hiringDateGd = new GlideDateTime(hiringDate);
var currentDateGd = new GlideDateTime();
var hiringYear = hiringDateGd.getYearUTC();
var currentYear = currentDateGd.getYearUTC();
var experience = currentYear - hiringYear;
template.print(experience);
Thanks & Best regards,
Medi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 10:57 AM
Please replace "var currentYear = current.getYearNoTZ();" to:
var currentYear = currentDated.getYearNoTZ();
Make sure the date passed in line 7 is in the format of yyyy-mm-dd
Thanks & Best regards,
Medi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 05:52 AM
Hi @Medi C,
It is printing as given screenshot :
Can you please help me to print like below screenshot :
Regards,
Nivedita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 06:18 AM
@niveditakumari
Please use the following content:
Congratulations on ${mail_script:yearsOfWorking} Amazing Years, ${first_name} ${last_name}
Dear ${first_name} ${last_name},
Today marks a special milestone for ${first_name} ${last_name}'s ${mail_script:yearsOfWorking}-year work anniversary at ACME South America! Over the years, ${first_name} ${last_name} has consistently contributed their qualities/skills to our team.
From leading successful projects in department Product Management to mentoring new team members, ${first_name} ${last_name} has been an invaluable part of our journey." Your commitment and hard work have made a lasting impact, and we're so grateful to have you as part of our ACME South America family.
Let's all take a moment to congratulate ${first_name} ${last_name} and celebrate their incredible journey with us. Here's to many more successful years together!
Thank you for being an inspiration and for all the contributions you've made. Happy Work Anniversary, ${first_name} ${last_name}!
Signature:
Aruna,
Human Resource Manager.I believe I've addressed all of your questions. If you're satisfied with the solution, kindly click the thumbs up and accept my answer to close this thread.
Thanks & Best regards,
Medi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 09:26 AM
Hi @Medi C,
Can you please make me understand about that line :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 09:44 AM
If you are using DateTime field please adjust the script as follow:
var hiringDate = current.u_hr_hire_date;
var hiringDateGd = new GlideDateTime(hiringDate);
var currentDateGd = new GlideDateTime();
var hiringYear = hiringDateGd.getYearUTC();
var currentYear = currentDateGd.getYearUTC();
var experience = currentYear - hiringYear;
template.print(experience);
Thanks & Best regards,
Medi
