Add the Date 3 days before to workitem expiration in Email Template

Hi Sailers,

I would like to add date in certification reminder email template. That Date should be 3 days before the expiration. I tried below code but not working. Any inputs would be appreciated.

Case 1:

#set($dummyDate=$spTools.formatDate($certification.expiration,“MM/dd/yyyy”))
#if($dummyDate)
#set($dummyUtil=$spTools.class.forName(“sailpoint.tools.Util”).newInstance())
#if($dummyUtil)
#set($dummydueDate=$dummyUtil.incrementDateByDays($dummyDate,-3))
#end
#end

Case 2:

#set($dummyUtil=$spTools.class.forName(“sailpoint.tools.Util”).newInstance())
#if($dummyUtil)
#set($dummydueDate=$dummyUtil.incrementDateByDays($certification.expiration,-3))
#end

Using $dummydueDate in the email text.

Regards,

Veerender.

how about using something like this

$spTools.formatDate($spTools.class.forName(“sailpoint.tools.Util”).newInstance().incrementDateByDays($certification.expiration,-3),“MM/dd/yyyy”)

Thanks for the response  @ajmerasunny

Working in the Body. But in Subject it is coming as  Empty.

Due to subject char limitation, I have tried execute only date.

Case 1:

<Subject>$spTools.formatDate($spTools.class.forName(“sailpoint.tools.Util”).newInstance().incrementDateByDays($certification.expiration,-2),“MM/dd/yyyy”)</Subject>

Response is Empty

and

Case2:

<Subject>#set($ruleArgs={ “expirationDate”:$certification.name})#set($ruleObj=$spctx.getObjectByName($spTools.class.forName(“sailpoint.object.Rule”),“Certification_Due_Date”))#set($dueDateByRule=$spctx.runRule($ruleObj,$ruleArgs))$dueDateByRule</Subject>

Response is $dueDateByRule

The above one i am executing the rule. In rule i am calculating the date and same code working body as well.

Case3:

<Subject>#set($ruleArgs={ “expirationDate”:$certification.name})#set($ruleObj=$spctx.getObjectByName($spTools.class.forName(“sailpoint.object.Rule”),“Certification_Due_Date”))$spctx.runRule($ruleObj,$ruleArgs)</Subject>

Response is $spctx.runRule($ruleObj,$ruleArgs)

Above scenarios not worked for me. I have customized the certification tags and used that in the Subject line. That worked for me.

Thanks a lot