EMAIL NOTIFICATION

AkashKushwah
Tera Contributor

Hi Everyone ,

I have written an email notification with email script which show the current year in signature like @2025 for this year how to check for next year . I have attached my email script and notification below . can anyone check my code is it correct or not .

Thank you

3 ACCEPTED SOLUTIONS

GlideFather
Tera Patron

Hi @AkashKushwah,

 

just add +1 as seen below: 

 

var currentYear = new Date().getFullYear();
var nextYear = currentYear + 1;
gs.info(nextYear);

 

KamilT_0-1752757550576.png

 

 

———
/* If my response wasn’t a total disaster ā†™ļø ⭐ drop a Kudos or Accept as Solution āœ… ā†˜ļø Cheers! */


View solution in original post

Shaik Dimple
Tera Expert

Hi @AkashKushwah ,

 

This script may help, it prints the next year dynamically in the email signature:

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

 
    var gdt = new GlideDateTime();
    var curYear = gdt.getLocalDate().getYear(); // safely gets current year as number
    var nextYear = curYear + 1;

  
    template.print("@" + nextYear);

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

 Screenshot 2025-07-17 185539.pngScreenshot 2025-07-17 185525.png

View solution in original post

Hi @AkashKushwah 
my response was the same and I replied earlier than the accepted one, can you please tell me why did you decide to accept this solution and not mine? thank you

———
/* If my response wasn’t a total disaster ā†™ļø ⭐ drop a Kudos or Accept as Solution āœ… ā†˜ļø Cheers! */


View solution in original post

6 REPLIES 6

Shaik Dimple
Tera Expert

Hi @AkashKushwah ,

 

This script may help, it prints the next year dynamically in the email signature:

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

 
    var gdt = new GlideDateTime();
    var curYear = gdt.getLocalDate().getYear(); // safely gets current year as number
    var nextYear = curYear + 1;

  
    template.print("@" + nextYear);

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

 Screenshot 2025-07-17 185539.pngScreenshot 2025-07-17 185525.png

Hi @AkashKushwah 
my response was the same and I replied earlier than the accepted one, can you please tell me why did you decide to accept this solution and not mine? thank you

———
/* If my response wasn’t a total disaster ā†™ļø ⭐ drop a Kudos or Accept as Solution āœ… ā†˜ļø Cheers! */