08/17/2022 11:59 PM
Hi ,
I am trying to fetch the exact string entered in Business Justification in Email-Template .I tried using below :
<div><b>Business Justification:</b> ${accessItems.collect{it.comments.toString()}.toListString().replaceAll('\\[|\\]','')}</div>
However I'm getting the result of above, as timestamp + requestor + actual business justification text as shown below
Business Justification: 08/17/2022 UTC -Thummala Bhavya(tbhavya) Test email notification
I want only actual business justification text i.e., "Test email notification". How can we achieve this? Do we have any binding variable which can fetch only the business justification text?
Regards,
Bhavya.
08/18/2022 04:59 AM
${accessItems.collect{it.comments.toString().substring(it.comments.toString().indexOf('UTC -')+it.comments.toString().length())}.toListString().replaceAll('\\[|\\]','')}
08/18/2022 07:58 AM
Hi Rushikesh,
Thanks for the response.
I tried this but getting an error.
I got below error in logs
java.lang.StringIndexOutOfBoundsException: String index out of range: -40
at java.lang.String.substring(String.java:1931)
at SimpleTemplateScript579$_run_closure2.doCall(SimpleTemplateScript579.groovy:20)
at SimpleTemplateScript579.run(SimpleTemplateScript579.groovy:20)
at com.saviynt.mail.EmailHistoryService$_execute_closure17.doCall(EmailHistoryService.groovy:2125)
at com.saviynt.mail.EmailHistoryService.execute(EmailHistoryService.groovy:1060)
at EmailHistoryJob.execute(EmailHistoryJob.groovy:30)
Regards,
Bhavya.
08/18/2022 01:16 PM
08/21/2022 11:20 PM
Hi Rushikesh,
It's partially worked I'm getting now below output.
Thummala Bhavya(tbhavya) Test email notification
The requirement was to print only "Test email notification" which we achieved using below configuration.
${accessItems.collect{it.comments.toString().substring(it.comments.toString().lastIndexOf(']')+1)}.toListString().replaceAll('\\[|\\]|\\n|\\r|\\t','')}
Regards,
Bhavya.
08/21/2022 11:31 PM
This won't work as user name will be dynamic & you can't assume comment some one can add () in comments