Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Email Script Needs to show current year

pramn
Kilo Sage

Team , 

we have a notification which should show current year but it's showing 2022, i checked there is mail script running , can you help me , how it can be changed to current year (2023) 

pramn_0-1679467341416.png

Script 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {

// Add your code here
var fiscalYear = current.u_year || current.u_actual_assignment.u_year || current.u_parent.u_year;
var fisCalYearArr = fiscalYear.split('-');
template.print(fisCalYearArr[1]);

})(current, template, email, email_action, event);

 

 

 

5 REPLIES 5

Thanks Buddy 

I just used this below , however both year is showing now .

pramn_0-1679471097722.pngpramn_1-1679471173478.png

Please help me to fix this .