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

If else in service account creation email based on owner details

smitg
Regular Contributor III
Regular Contributor III

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

 

6 REPLIES 6

sk
All-Star
All-Star

@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}


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

DixshantValecha
Saviynt Employee
Saviynt Employee

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"
}
%>

@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

 

ServiceAccountOwnerMap
allApprovers
allRejectors

Are you confirming that it will work?


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

Hi @sk,

We acknowledge and appreciate your perspective; however, we would like to verify the functionality of this code on the end of  '@smitg'.

smitg
Regular Contributor III
Regular Contributor III

Hi @DixshantValecha ,

We tried the code given by you, not able to create email template getting below error

smitg_0-1697713110538.png

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

Manu269
All-Star
All-Star

@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

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