and more in a single search tool across platforms. Read the announcement here. |
10/18/2023 07:17 AM
Hi Team,
We are trying to achieve show and hide particular line in email template based on below condition
if owner is not same as requestor then show 'Note' and if requestor is same as owner then don’t show.
We are trying below expression but it’s not working
<% if ${ServiceAccountOwnerMap.get("ALL")?.collect{it.email.toString()}?.join(',').toString().replaceAll('\\[','').replaceAll('\\]','').contains(${user.email})} print "Note:SVC account password email" else print "" %>
Any help on this is much appreciated.
Thanks,
Smitha
10/18/2023 07:32 AM - edited 10/18/2023 07:33 AM
@smitg : We faced an issue with ServiceAccountOwnerMap, This variable is always giving null value and when we opened a ticket with Saviynt they asked us to open an IDEA. We have already opened an IDEA for the same: EIC-I-4118 . Please upvote this.
Also coming to your requirement you may need to try some alternatives. I think you can try below condition provided if you are assigning only one owner
requestor = ${com.saviynt.ecm.identitywarehouse.domain.Users.findById(USEROWNERKEY)?.username}
10/18/2023 08:01 AM
Hi @smitg,
Please try below code as well
<%
def ownerEmail = ServiceAccountOwnerMap.get("OWNER_EMAIL") // Replace 'OWNER_EMAIL' with the key used to retrieve the owner's email.
def requestorEmail = user.email
if (!ownerEmail || !requestorEmail) {
print "Email addresses not found."
} else if (ownerEmail.equals(requestorEmail)) {
// Owner is the same as the requestor, so don't show the line.
// You can put the HTML code for the line you want to hide here.
} else {
// Owner is not the same as the requestor, so show the 'Note' line.
print "Note: SVC account password email"
}
%>
10/18/2023 11:09 AM - edited 10/18/2023 11:10 AM
@DixshantValecha : Are you sure ServiceAccountOwnerMap is having values? Was condition you shared is tested and working? Because as I said it was not exposing any values as per our troubleshooting and when we opened ticket we were asked to put as enhancement as it is not supported for service account
Please refer the FD: 1597379 for more details. None of the below variables are exposed as per this ticket
Are you confirming that it will work?
10/18/2023 10:54 PM
Hi @sk,
We acknowledge and appreciate your perspective; however, we would like to verify the functionality of this code on the end of '@smitg'.
10/19/2023 04:00 AM
Hi @DixshantValecha ,
We tried the code given by you, not able to create email template getting below error
code tried:
<%
def ownerEmail = ServiceAccountOwnerMap.get("ALL")?.collect{it.email.toString()}?.join(',').toString().replaceAll('\\[','').replaceAll('\\]','')
def requestorEmail = user.email
if (!ownerEmail || !requestorEmail) {
print "Email addresses not found."
} else if (ownerEmail.equals(requestorEmail)) {
} else {
print "Note: SVC account password email"
}
%>
Please let me know if we are missing something here
Thanks,
Smitha
10/18/2023 09:04 PM
@sk I have even validated the same using the binding variables and we see its always a null.
upvoted the link : Expose listed workflow binding variables for | Saviynt Ideas Portal