Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

EMail template for Analytic report that shows the number of days left until the user enddate

DBorchers
New Contributor III
New Contributor III

Hello,

we have created an Analytics report that sends an email 10 and 20 days before the user end date is reached.
Is it possible to display the remaining days until user deactivation (difference today - user enddate) in the email body?
Attempts to calculate the remaining days via groovy.time.TimeCategory have not worked so far.

5 REPLIES 5

pruthvi_t
Saviynt Employee
Saviynt Employee

Hi @DBorchers ,

You can try to make use of DATEDIFF() function in your query to calculate difference of days from today to end date.

You can use something like DATEDIFF(enddate,now()) as Remaining days in your SQL query.

ex: I used it to test for a user whose end date is 06-30-2023 and used DATEDIFF(enddate,now()) in SQL query and the days were shown as 115 in the result.

Thanks,


Regards,
Pruthvi

Manu269
All-Star
All-Star

@pruthvi_t I too have a similar ask from customer.

We need to display the remaining days until user deactivation (difference today - user enddate) in the email body?

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

@Manu269 , the datediff i mentioned was for query of the analytics. But to display the days on the email body, I’ll check on it and get back to you.

thanks,


Regards,
Pruthvi

rushikeshvartak
All-Star
All-Star

what is date format 

${new java.text.SimpleDateFormat('MMMM dd, yyyy').format(user?.endDate)}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Actually the ${user?.enddate} = 2023-03-18 00:00:00.0

When implementing ${new java.text.SimpleDateFormat('MMMM dd, yyyy').format(user?.endDate)} in my email body, i got only the following email:

DBorchers_0-1678275539883.png