Ok, this seems to come up regulatly, but without a resolution, so I wanted to propose it again, and add some specifics details for it, as well as show some anomalies I am seeing with this in my Ambassador tenant.
First off, details of what I am trying to do:
Email Template: Certification Reassign
Email Template Version: V1
Problem statement: Trying to change $certification.expiration from GMT to another timezone (EST, CST and NZ used for testing)
Known limitations:
- V1 email templates do not have the dateTools, only spTools (Reference: https://documentation.sailpoint.com/saas/help/common/emails/available_templates.html#global-variables-version-1-and-2-templates )
- Apache Velocity available.
Issues present:
- Unable to convert the timezone from GMT to EST/CST/NZ
- Discrepancies between test email functionality and actual reassignment usage
During my research, I found that there was a $date variable available, and this works to get the current date when using the TEST EMAIL button.
Here is what I put together for hte body of the email to test with knowing that the $date function worked using the test email.
Dear ${user.name},
${requesterName} has assigned ${numNewIdentities} #if(${numNewIdentities} == 1) user #{else} users #end to you for review in a certification.
Reason for reassignment: ${description}
You have until $spTools.formatDate($certification.expiration,3,0) to review and either approve, change, or revoke access for these users.
TESTING DATES
-----------------------------------
[Base Date Values]
Date: $date
CertExpireDate: $certification.expiration
[Set them to new variables with Velocity]
#set( $varDate = $certification.expiration )
Date: $varDate
#set( $varCertExpDate = $certification.expiration )
CertExpireDate: $varCertExpDate
[Format Base Date with spTools]
#set($formattedDate=$spTools.formatDate($date,"MM/dd/yyyy HH:mm"))
Date: $date
#set($formattedCertExpDate=$spTools.formatDate($certification.expiration,"MM/dd/yyyy HH:mm"))
CertExpireDate: $formattedCertExpDate
[Format Variable Date with spTools]
#set($formattedDate=$spTools.formatDate($varDate,"MM/dd/yyyy HH:mm"))
Date: $date
#set($formattedCertExpDate=$spTools.formatDate($varCertExpDate,"MM/dd/yyyy HH:mm"))
CertExpireDate: $formattedCertExpDate
-----------------------------------
[Format Base Date with velocity dateTool - Direct]
Date: $date.format("yyyy-MM-dd'T'HH:mm:ss", $date, $date.getLocale(), $date.getTimeZone().getTimeZone("NZ"))
CertExpireDate: $certification.expiration.format('yyyy-MM-dd"T"HH:mm:ss', $certification.expiration, $certification.expiration.getLocale(), $certification.expiration.getTimeZone().getTimeZone('NZ') )
[Format Base Date with velocity dateTool - Variable Date]
Date: $varDate.format('yyyy-MM-dd"T"HH:mm:ss', $varDate, $varDate.getLocale(), $varDate.getTimeZone().getTimeZone('CST') )
CertExpireDate: $varCertExpDate.format('yyyy-MM-dd"T"HH:mm:ss', $varCertExpDate, $varCertExpDate.getLocale(), $varCertExpDate.getTimeZone().getTimeZone('NZ') )
Click here to review the certification.
When I test this in my Ambassador tenant using the TEST EMAIL button, I get the following response to my email:
.
If you look at the results, you can see that the $date variable is set to the current time, and if you look at the second arrow, the date is in fact formatted for the correct timezone. You will also notice that the templated items not evaludated show up normally.
Now that I had that, I created a certification to test this with, and then reassigned a certification item to my user so I could test the results using the actual certification details:
.
Now if we look at the email that was received, we see in the first Red arrow that the date is set to the expiration as expected, and in the first Orange arrow, that the variable is set correctly to this same value.
However, if we look at the second Red arrow, we see that using $certification.expiration in place of $date just puts the date calue in line, and does not evaluate it. Additionally, if we look at the second Orange arrow, it does not even evaluate the variable that was set above correctly. Aside from changing the $date value to match the certification expirations, this section is exactly the same, however it is functioning differently using the TEST EMAIL and using the standard functionality.
So my questions that I could use help with are:
- Is this intended functionality that they should process differently?
- How can I convert the Timezone from GMT to another timezone in a V1 Template?