Using custom java code in the Saviynt Email Templates
Sometimes in complex requirements, we may not able to use groovy scripts to meet the requirements in that situation we can use custom java code in the Saviynt email templates
Another use case is that the subject field in Saivynt supports only 255 characters, if you have complex if-else logic which makes more than 255 characters then you can use custom java code to generate the subject line, however, make sure the custom java code returns less than 255 characters as the subject line to avoid unnecessary references issue(in audit tables?).
Requirement: Generate a subject line based on the below conditions
If the user's employee type is Internal then
New Personal AD Account is created for you, Account Name: [ Account display name ]
otherwise
New Personal AD Account is created for a user starting on [User start date in dd-MM-YYYY format], Account Name: [ Account display name ]
Step 1: Create a java package and create a JAR
The source code is available in the below link
https://github.com/ravikumarghr/calculateContentForSaviyntEmailNotifications
once you configure the below code into Eclipse follow the below steps to create the jar
a. Right-click on the class and select Export
b. Select the Jar option and select the class "EmailNotifications" and all classes from Package "com.ghrartifacts.utilities" and export as jar
Step 2: Update externalconfig.properties file
Add these properties to externalconfig.properties file by Navigating Admin => Settings => Configuration Files
GHR_LOG_LEVEL=INFO
GHR_DATE_FORMAT_FOR_EMAIL_NOTIFICATIONS=dd-MM-YYYY
Step 3: Upload the Jar to Saviynt Instance and Restart
This may vary in a different version of Saviynt, these steps are for v2021
Navigate to Admin => Settings => File Directory => externalJar and upload your Jar file and restart the Instance by
Navigating to Admin => Admin Functions Application Restart
Step 4: Using custom Java code in the email templates
Below code can be used in Subject line or Body of the Saviynt email templates
${com.ghrartifacts.EmailNotifications.getSubjectForNewAccountCreateNotification(user.employeeType,user.startdate.toString(),account.displayName)}
Comments
Post a Comment