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

Fetching substring in Email templates

tbhavya
New Contributor
New Contributor

Hi Team,

We have a requirement to display only Security group name in email templates.
In the entitlement value we have "Job and Position Administrator (UB-HR-Job_and_Position_Administrator)" which is combination of security group name and Tenent security Id.
Requirement is to display only "Job and Position Administrator" while sending email notification and we tried few options but that didn't work

i.e,
<div>Entitlement Value: ${entitlement_values}.get[0].substring ${entitlement_values}.indexOf(" (",1) </div>
<div>Entitlement value: entitlement_values.substring(entitlement_values.indexOf(" ("),1)) </div>
<div>Entitlement Value: <% if (${entitlement_values}.contains(" (")) print "SUBSTRING_INDEX(${entitlement_value}, " (", 1) else print "${entitlement_value}" %></div><br>

Could you please advise how can we achieve this.

Thanks,

Bhavya.

10 REPLIES 10

rushikeshvartak
All-Star
All-Star

Is it possible to store value in entitlement customproperty / display name / glossary while import? 

Which connector is used? 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hi Rushikesh,

We are using "Workday connector"

Not possible to store value anywhere as we don't have mapping available at the connector level

sahajranajee
Saviynt Employee
Saviynt Employee

@tbhavya ,

Can you tell me which email templates are you trying this in?


Regards,
Sahaj Ranajee
Sr. Product Specialist

Hi Sahaj,

We are using notification email template as shown in the screenshot below.

tbhavya_0-1660305654689.png

 

sahajranajee
Saviynt Employee
Saviynt Employee

Hi @tbhavya ,

This worked for me :

${entitlement_values.collect{it.toString().indexOf("(") == -1 ? it : it.toString().substring(0, it.toString().indexOf("(") -1)}}

Entitlement Value : 

sahajranajee_0-1660311531001.png

Email : 

sahajranajee_1-1660311565656.png

 

 





Regards,
Sahaj Ranajee
Sr. Product Specialist

Hi Sahaj,

Thank you. It worked.

However, Is it possible to remove square bracket [] from security group name?

i.e., Job and Position Administrator

 

${entitlement_values.collect{it.toString().indexOf("(") == -1 ? it : it.toString().substring(0, it.toString().indexOf("(") -1).replaceAll("\\[","").replaceAll("\\]","")}}

 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

sahajranajee
Saviynt Employee
Saviynt Employee

@tbhavya 

I tried the following for it, worked :

${entitlement_values.collect{it.toString().indexOf("(") == -1 ? it : it.toString().substring(0, it.toString().indexOf("(") -1)}.toListString().replaceAll('\\[|\\]','')}


Email :

sahajranajee_0-1660321064438.png

 




Regards,
Sahaj Ranajee
Sr. Product Specialist

It worked. Thank you

Regards,

Bhavya.

sahajranajee
Saviynt Employee
Saviynt Employee

Thanks @tbhavya 
Please mark the answer as solution to close the topic.


Regards,
Sahaj Ranajee
Sr. Product Specialist