and more in a single search tool across platforms. Read the announcement here. |
03/15/2024 07:19 AM
Hello,
We are attempting to implement an email template that displays information about a user based on any null values they may have.
e.g.: if (user.costcenter == null) print "[something1...]" if (user.employeeID == null) print "[something2...]" if ...
We have attempted various methods to achieve this use case, but the email never arrives as evidenced by the error message in the logs: 'Error while sending email'.
Could someone please assist us with this issue?
Thank you in advance.
Regards,
Alan Rojas
03/15/2024 07:29 AM - edited 03/15/2024 07:30 AM
Hi Alan,
I had a similar issue a couple of weeks ago. This is how I fixed it.
<% if (user.customproperty10 == 'Internal' || user.customproperty10 == 'Student' ) print "Internal or Student" else if (user.customproperty10 == 'External' ) print 'External' %>
It might not work right away (like many things in Saviynt).
Then it should work.
Some fields, like Subject and To have a max length of 255 chars (including the code). If it is any longer it will fail with a badly described error in the logs.
I hope this helps you!
03/20/2024 02:55 AM
Hello!
Thank you for your response, we have tried, but is not exactly the use case we want.
We need to use several if statements instead of an "elif". You know how could we achieve this?
Thank you,
Regards,
Alan Rojas
03/20/2024 02:58 AM
Have you tried just using several if clauses instead? I don't see any issue with doing so - There is no need for an else if.
03/20/2024 02:59 AM
We have tried it but it will show us the error mentioned above.
03/20/2024 03:03 AM
Maybe try something like
if (user.costcenter == null) print "[something1...]" else print ""
This way you can rule out, that your condition (user.costcenter == null) is the issue. If it is still not working, you should take a close look at the conditions you are using.
03/26/2024 10:37 AM
Hello,
We have tried that but still no success... As you said, we have ruled out that the condition "equals null" is not the problem.
03/20/2024 03:12 AM
Please share what you tried so far
03/17/2024 06:26 PM
Provide more context for your ask.
03/26/2024 10:47 AM
This is the original email template, we have tried with several modifications but no success:
03/26/2024 12:46 PM
A few other things to try:
1) Try user?.<attribute name> ex: user?.displayname
I have seen issues with the email templates where this check will help with the parser errors.
2) Also for some variables, Saviynt has a bad habit of needing the case of the attribute name to match what is in the database table. I know it should only apply for SQL queries but its worth a shot. For example: systemusername is actually systemUserName
https://docs.saviyntcloud.com/bundle/SSM-DB-Schema-Reference-v55x/page/Content/Identity-Repository-S...
03/26/2024 07:47 PM
Can you share result of below
To get what variables are present to use in the email template, check using the below expression. By putting it in the email body, it will print all variable names with values, and then accordingly, you can use it:
${this.binding.variables.each {k,v -> println "$k = $v" + "" + "br" + ">"}}
Also change variables
user?.systemUserName
user?.displayName
user?.manager
04/09/2024 06:57 AM
Hi, after trying the following email templates:
Dear IT Services,<br><br>Critical attributes are missing for the user ${user.displayname}. <br>
<ul>
<%if(user?.employeeID == "")print "<li>EmployeeID<br></li>"%>
<%if(user?.systemusername == "")print "<li>SystemUsername<br></li>"%>
<%if(user?.costcenter == "")print "<li>Cost Center<br></li>"%>
<%if(user?.manager == "")print "<li>Manager<br></li>"%>
</ul>
Best regards,<br><br>Your friendly IAM system<br><br>
AND
<ul>
<%if(user?.employeeID == null)print "<li>EmployeeID<br></li>"%>
<%if(user?.systemusername == null)print "<li>SystemUsername<br></li>"%>
<%if(user?.costcenter == null)print "<li>Cost Center<br></li>"%>
<%if(user?.manager == null)print "<li>Manager<br></li>"%>
</ul>
Best regards,<br><br>Your friendly IAM system<br><br>
with a user who has an empty costcenter, we still get the following error
Error while sending emailText must not be null
2024-04-09T12:18:53+02:00-ecm-worker--null-84vr9--java.lang.IllegalArgumentException: Text must not be null at com.saviynt.ecm.services.EmailerService.sendMail
Could you please attach a working sample adapted to our email template?
04/09/2024 07:02 AM
Share email template screenshot
04/09/2024 08:36 AM
Here´s the screenshot:
Thank you,
Regards,
Alan Rojas
04/09/2024 09:02 AM
Does email gets trigger without dynamic variables ?
04/09/2024 09:14 AM
Yes, it works. The problem arises whenever we attempt to add more if conditions.
04/09/2024 09:31 AM
Add condition one by one and validated which variable is breaking
04/12/2024 02:58 AM
We have tried to validate each attribute one by one and the ones that are not working are Systemusername and EmployeeID. Any clue why these are not working properly?
Thank you.
Regards,
Alan Rojas
04/12/2024 05:32 AM
Try
user?.systemUserName
user?.employeeId
04/15/2024 02:31 AM
We have tried with the "?" and without it, it is not working either way.
04/15/2024 09:16 PM
Then variable is not supported
04/16/2024 01:37 AM
So there is no way Saviynt will allow us to complete this use case? Is there any workaround so we can achieve our goal?
Thank you.
04/16/2024 10:13 PM
No. Please raise idea ticket