01/12/2023 02:20 AM
HI Team,
I have a requirement to sent out approval notification to user based on the option selected during user enrollment.
Ex: We have 10 different Hrs available and notification for HR approval should be sent only based on the HR selected during enrollment. I am able to fetch the HR records and display to user and save the selection to a property file. But How do i sent approval notification only to selected HR?
And also i am using below place holder in email
${accessItems.findAll{it.request_access_attrss.size()}.collect{it.request_access_attrss.findAll{(it.attributeName.toString().equalsIgnoreCase('companyname'))}.collect{it.attributeValue}}.toString().replace('[','').replace(']','')}</td> </tr><tr> <td>Business Unit</td> <td> ${accessItems.findAll{it.request_access_attrss.size()}.collect{it.request_access_attrss.findAll{(it.attributeName.toString().equalsIgnoreCase('customproperty12'))}.collect{it.attributeValue}}.toString().replace('[','').replace(']','')}
This is working fine for new users created and all the dynamic attributes are printed in the email but when the user gets modified, only the modified attributes are getting printed in the template.
Can you specify the place holder which can satisfy both the conditions?
Thanks in advance
01/12/2023 04:13 AM - edited 01/12/2023 04:13 AM
attribute_oldValue
01/12/2023 04:46 AM
Can you give a sample for attribute_oldValue. And any idea on how to achieve approval notification based on dyn attribute selection?
01/12/2023 09:24 AM
Since you are pulling the value from request_access_attrss which will only hold the data that is coming from current request in your case only modified data. I don't think you can get the value from dynamic attributes which are not part of request.
If you have saved the values of dynamic attributes to custom properties then you can use those as variables. Meaning if you copied DA1 value to user CP1 then you can use ${user.customproperty1} to pull that information in case of modify request. In template you can check if request is create or modify accordingly you can change the parameter. If create request then use same parameter you are using currently if modify then use user attributes.
03/28/2023 06:07 AM
HI @sk i tried to use if else condition but it is not working.
Below is the error from logs
"ecm-worker","2023-03-28T12:56:19.051+00:00","{"log":"SimpleTemplateScript9363.groovy: 1: unexpected token: ).replace( @ line 1, column 3157.\n","stream":"stdout","time":"2023-03-28T12:56:18.666554449Z"}"
"ecm-worker","2023-03-28T12:56:19.051+00:00","{"log":" lue}}.toString().replace('[','').replace\n","stream":"stdout","time":"2023-03-28T12:56:18.66655708Z"}"
"ecm-worker","2023-03-28T12:56:19.051+00:00","{"log":" ^\n","stream":"stdout","time":"2023-03-28T12:56:18.666559875Z"}"
"ecm-worker","2023-03-28T12:56:19.051+00:00","{"log":"\n","stream":"stdout","time":"2023-03-28T12:56:18.666562513Z"}"
"ecm-worker","2023-03-28T12:56:19.051+00:00","{"log":"1 error\n","stream":"stdout","time":"2023-03-28T12:56:18.666565157Z"}"
"ecm-worker","2023-03-28T12:56:19.051+00:00","{"log":"\n","stream":"stdout","time":"2023-03-28T12:56:18.666567469Z"}"
Attached the sample template. let me how to add the values. this is for update user request