Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Get substring of Endpoint

SDBeltran
New Contributor II
New Contributor II

Hello guys, I have a very simple question. I want to customize an Access Request Approval Notification email template including a substring from the Endpoint's name where the task was just performed. The endpoint's name can be easily retrieved from ${task.endpoint.endpointname}, but I have not been able to get the "DB_Namex" from the Endpoint's name. Here is the naming convention of the endpoint's name:
Database Type - Customer1 (DB_Name1) - Prod
Database Type - Customer2 (DB_Name2) - UAT
Database Type - Customer3 (DB_Name3) - Pilot

Again, I'm looking to extract only what's in between parenthesis, "DB_Namex". I've tried a few snippets of other forums that I've found helpful, but with very little luck:
- ${task.endpoint.endpointname.toString().substring(task.endpoint.endpointname.toString().indexOf("(")+1, task.endpoint.endpointname.toString.indexOf(")") -1)}
- ${task.endpoint.endpointname.collect{it.toString().indexOf("(") == -1 ? it : it.toString().substring(it.toString().indexOf("(")+1, it.toString().indexOf(")") -1)}}

I'm getting: There was an error while evaluating the email template, please login to ARS and complete the tasks assigned to you in the email notification.

Any help would be greatly appreciated!!!

Thanks!

2 REPLIES 2

rushikeshvartak
All-Star
All-Star
${task?.endpoint?.endpointname?.toString()?.substring(task?.endpoint?.endpointname?.indexOf('(') + 1, task?.endpoint?.endpointname?.indexOf(')'))}

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Thankyou @rushikeshvartak!!! That was it!! It is working now. Appreciate it!