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

Use Dynamic attribute in Email Template

Tezinder
New Contributor
New Contributor

Hi,

I am trying to use a endpoint dynamic attribute in the "To" field of the email template but it is not working. 

I referred to this article: https://docs.saviyntcloud.com/bundle/EIC-Admin-v23x/page/Content/Chapter06-EIC-Configurations/Creati...

"PasswordEmail" is the dynamic attribute name. I have tried these queries:

1. ${task?.endpoint?.PasswordEmail}

2. ${endpoint?.PasswordEmail}

3. ${accessItems.collect{ it.request_access_attrss.find{it.attributeName.toString().equalsIgnoreCase('PasswordEmail')}.collect{it.attributeValue}}.get(0)

4. ${dynamicAttrsList.find{ it.attributeName?.equalsIgnoreCase('PasswordEmail') }?.attributeValue}

5. ${PasswordEmail}

This is the error that i get:

2024-04-17T18:51:32+05:30-ecm-worker-services.EmailerService-quartzScheduler_Worker-9-ks992-DEBUG-SmtpError in sending email: [headers:[Cache-Control: private, Transfer-Encoding: chunked, Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 8f26ff7d-d0f1-4b41-acaa-e0f9e375faa1, client-request-id: 8f26ff7d-d0f1-4b41-acaa-e0f9e375faa1, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"010","RoleInstance":"DB1PEPF00056381"}}, Date: Wed, 17 Apr 2024 13:21:32 GMT], responseText:{"error":{"code":"ErrorInvalidRecipients","message":"At least one recipient is not valid., Recipient '${PasswordEmail}' is not resolved. All recipients must be resolved before a message can be submitted."}}, cookies:[], statusCode:400]

Can someone please help solve this?

[This post has been edited by a Moderator. We discourage the @ mention of other forum users or employees unless they have already involved themselves on the forum post.]

13 REPLIES 13

Saathvik
All-Star
All-Star

@Tezinder : Are you triggering email from Workflow or Endpoint level email notification(task notifications)?


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

I am trying it from endpoint level email notification. I am using change password for others option to create change password task which will then trigger email with password from endpoint email notification

Raghu
Valued Contributor III
Valued Contributor III

try this

${dynamicAttrsList.collect{it.attributeName?.equalsIgnoreCase('PasswordEmail') }?.attributeValue}

and

${dynamicAttrsList.find{it.attributeName?.equalsIgnoreCase('PasswordEmail')}.attributeValue}


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

Tezinder
New Contributor
New Contributor

Unfortunately, didn't worked, getting the same error:

2024-04-17T20:21:08+05:30-ecm-worker-services.EmailerService-quartzScheduler_Worker-6-kt2hf-DEBUG-SmtpError in sending email: [headers:[Cache-Control: private, Transfer-Encoding: chunked, Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 0da4ac75-4ff8-4e49-a456-b6e9c0b0397e, client-request-id: 0da4ac75-4ff8-4e49-a456-b6e9c0b0397e, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"008","RoleInstance":"DU2PEPF0002605A"}}, Date: Wed, 17 Apr 2024 14:51:07 GMT], responseText:{"error":{"code":"ErrorInvalidRecipients","message":"At least one recipient is not valid., Recipient '${dynamicAttrsList.collect{it.attributeName?.equalsIgnoreCase('PasswordEmail') }?.attributeValue}' is not resolved. All recipients must be resolved before a message can be submitted."}}, cookies:[], statusCode:400]

@Tezinder : Try below 

${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('PasswordEmail')}.collect{it.attributeValue}}.get(0).join(', ')}

 


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

Did not worked. 

This is the error i am getting:

2024-04-18T14:43:33+05:30-ecm-worker-services.EmailerService-quartzScheduler_Worker-5-6trv2-DEBUG-SmtpError in sending email: [headers:[Cache-Control: private, Transfer-Encoding: chunked, Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 4e570f85-dacd-4026-a7b8-a8977afe5f55, client-request-id: 4e570f85-dacd-4026-a7b8-a8977afe5f55, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"011","RoleInstance":"DB1PEPF0005638B"}}, Date: Thu, 18 Apr 2024 09:13:33 GMT], responseText:{"error":{"code":"ErrorInvalidRecipients","message":"At least one recipient is not valid., Recipient '${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('PasswordEmail')}.collect{it.attributeValue}}.get(0).join('' is not resolved. All recipients must be resolved before a message can be submitted."}}, cookies:[], statusCode:400]

2024-04-18T14:43:33+05:30-ecm-worker--null-6trv2--18-Apr-2024 09:13:33.228 WARNING [quartzScheduler_Worker-5] groovy.sql.Sql.executeUpdate Failed to execute: INSERT INTO EMAILHISTORY(BODYOFEMAIL,CCADDRESS,CREATEDATE,EMAILTEMPLATE,STATUS,SUBJECTOFEMAIL,TOADDRESS,BCCADDRESS,SOURCE,FILEPARAMS,RETRYCOUNT,EMAILFAILURELOGS) VALUES ('YAcCJwuE1vkptQB+SuCRYZ8+860/xfhx2vvIDSVnQg3Rb35gz8+U9zw6jBTPC1lkuuJEfGZ2S5vNPorTZDMitHHOR2ChyVb6gM8m2wi9zzzP4ZcC/yQFyjdg0UA0v0tk3+zZhxRBYQ6qFX0W5Xovub4CXi6S+4aCq60FpXUBKNocOSQIC+nz9xL5LX8sMzZZutd+qMuipw5ibhHZJYcQqwwjU8lRnZTbVCABuFuGyx+c8t4to+RwXw5TaVxQ62VwlsddocaFcd72cgp3dw+s+4Gp/HzJ+eClhsNi9drPPBKm088QKIGOKNP12FA5mIahknZ4K5KFy0afKA1p1wkC5r4gQHxgVuOxU7ZKUObYyWzAoeZjIO+Fu+U8GYoVcn1eEOcLgFrIDXUh1CzgZJkNZgCnkLQVJwB/FdsAvB/pmy30xkrYxVSfW60NXA48IENRIgrdbzaPZl4aglwn7aP1BTIWFauDyZ5lCkWxTE3Dwdc=', '', '04-18-2024 09:13:33', 'N/A', 5, 'Password Reset for - XDS AD', '${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('PasswordEmail')}.collect{it.attributeValue}}.get(0).join(', ')}', '', 1, ?, 0,'SmtpError in sending email: [headers:[Cache-Control: private, Transfer-Encoding: chunked, Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 4e570f85-dacd-4026-a7b8-a8977afe5f55, client-request-id: 4e570f85-dacd-4026-a7b8-a8977afe5f55, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"011","RoleInstance":"DB1PEPF0005638B"}}, Date: Thu, 18 Apr 2024 09:13:33 GMT], responseText:{"error":{"code":"ErrorInvalidRecipients","message":"At least one recipient is not valid., Recipient ''${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase(''PasswordEmail'')}.collect{it.attributeValue}}.get(0).join('''' is not resolved. All recipients must be resolved before a message can be submitted."}}, cookies:[], statusCode:400]') because: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PasswordEmail')}.collect{it.attributeValue}}.get(0).join(', ')}', '', 1, '{}', 0' at line 1

rushikeshvartak
All-Star
All-Star

use below 

${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('PasswordEmail')}.collect{it.attributeValue}}.get(0).join(', ')}


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

This did not worked. Here is the error log:

2024-04-18T14:47:00+05:30-ecm-worker-services.EmailerService-quartzScheduler_Worker-5-6trv2-DEBUG-SmtpError in sending email: [headers:[Cache-Control: private, Transfer-Encoding: chunked, Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 94dab386-6f21-4c73-9c29-0421fb268131, client-request-id: 94dab386-6f21-4c73-9c29-0421fb268131, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"DU6PEPF0000E563"}}, Date: Thu, 18 Apr 2024 09:16:59 GMT], responseText:{"error":{"code":"ErrorInvalidRecipients","message":"At least one recipient is not valid., Recipient '${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('PasswordEmail')}.collect{it.attributeValue}}.get(0).join('' is not resolved. All recipients must be resolved before a message can be submitted."}}, cookies:[], statusCode:400]

2024-04-18T14:47:01+05:30-ecm-worker--null-6trv2--18-Apr-2024 09:17:00.575 WARNING [quartzScheduler_Worker-5] groovy.sql.Sql.executeUpdate Failed to execute: INSERT INTO EMAILHISTORY(BODYOFEMAIL,CCADDRESS,CREATEDATE,EMAILTEMPLATE,STATUS,SUBJECTOFEMAIL,TOADDRESS,BCCADDRESS,SOURCE,FILEPARAMS,RETRYCOUNT,EMAILFAILURELOGS) VALUES ('cn8E03SS9eB1ox98gsxKvuWDseB8BRNF028rI7Y4ttYCr9m1SMWGNoq7BlIm6yDLcGe6k6S3DfPifUrS5tIFL+VeKTMSM7Y3zXmXZ8ArxBxFG6kEjsglrdJrlACDBRxjmaJd+XwwRz4Uc1GSiHbeoqu38zJIMJkmdp9uTR3/f2V42BPQc2aDWrnMoyCHRixeJ/Mo1yNNeqMnScaU2GIqv8mD+vXSfuJIDJGbRqOV3iXDMA3otERr8XWQiKhDLOPheCDHpCHzs3czQMAlulQ/DWzxRUbMyrpcOn5DLwwq/3uxLdoNswCZVBhH0iVuH8bX0+dRPc+AF3K+m3tsUqIkAD0Mg70PwVWtPaN53kwIq2pNRfRkRGmpuWUs7kXoNL9Ng6B2u22kdebayQVribjF0qQ2arqrvUtPTNRfpNQWFQPQ1Xk/v7rATLn6mD8H5ONt43T0S5EsELHCIExQG7BeT3+wSieSlD4iucsfCMI10WQ=', '', '04-18-2024 09:17:00', 'N/A', 5, 'Password Reset for - XDS AD', '${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('PasswordEmail')}.collect{it.attributeValue}}.get(0).join(', ')}', '', 1, ?, 0,'SmtpError in sending email: [headers:[Cache-Control: private, Transfer-Encoding: chunked, Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 94dab386-6f21-4c73-9c29-0421fb268131, client-request-id: 94dab386-6f21-4c73-9c29-0421fb268131, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"DU6PEPF0000E563"}}, Date: Thu, 18 Apr 2024 09:16:59 GMT], responseText:{"error":{"code":"ErrorInvalidRecipients","message":"At least one recipient is not valid., Recipient ''${task?.requestAccessKey?.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase(''PasswordEmail'')}.collect{it.attributeValue}}.get(0).join('''' is not resolved. All recipients must be resolved before a message can be submitted."}}, cookies:[], statusCode:400]') because: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PasswordEmail')}.collect{it.attributeValue}}.get(0).join(', ')}', '', 1, '{}', 0' at line 1

2024-04-18T14:47:01+05:30-ecm-worker--null-6trv2--java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PasswordEmail')}.collect{it.attributeValue}}.get(0).join(', ')}', '', 1, '{}', 0' at line 1 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1092) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1040) at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1347) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1025) at com.saviynt.ecm.services.EmailerService.insertIntoEmailHistory(EmailerService.groovy:2923) at com.saviynt.ecm.services.EmailerService.modifyEmailHistory(EmailerService.groovy:2947) at com.saviynt.ecm.services.EmailerService.sendEmailOauth(EmailerService.groovy:2017) at com.saviynt.ecm.services.EmailerService.sendEmailBasedOnConfig(EmailerService.groovy:166) at com.saviynt.ecm.services.EmailerService.sendEmail(EmailerService.groovy:132) at com.saviynt.ecm.services.ArsTaskService$_sendTaskCompletionEmail_closure175_closure352_closure354.doCall(ArsTaskService.groovy:14429) at com.saviynt.ecm.services.ArsTaskService$_sendTaskCompletionEmail_closure175_closure352.doCall(ArsTaskService.groovy:14183) at com.saviynt.ecm.services.ArsTaskService$_sendTaskCompletionEmail_closure175.doCall(ArsTaskService.groovy:14099) at com.saviynt.ecm.services.ArsTaskService.sendTaskCompletionEmail(ArsTaskService.groovy:14092) at com.saviynt.ecm.services.ArsTaskHelperService$_whenTaskTypeIsFiveChangePassword_closure53.doCall(ArsTaskHelperService.groovy:3323) at com.saviynt.ecm.services.ArsTaskHelperService.whenTaskTypeIsFiveChangePassword(ArsTaskHelperService.groovy:3293) at com.saviynt.ecm.services.ArsTaskHelperService$_completeAutoProvTasksUpgraded_closure1.doCall(ArsTaskHelperService.groovy:180) at com.saviynt.ecm.services.ArsTaskHelperService.completeAutoProvTasksUpgraded(ArsTaskHelperService.groovy:160) at com.saviynt.ecm.services.ArsTaskHelperService.completeAutoProvTasksUpgraded(ArsTaskHelperService.groovy:91) at MultipleProvisioningJob.processInstProvTasks(MultipleProvisioningJob.groovy:489) at MultipleProvisioningJob$_processInstantProvTasks_closure15.doCall(MultipleProvisioningJob.groovy:767) at MultipleProvisioningJob.processInstantProvTasks(MultipleProvisioningJob.groovy:747) at MultipleProvisioningJob.execute(MultipleProvisioningJob.groovy:45) at org.quartz.core.JobRunShell.run(JobRunShell.java:199) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)

@Saathvik any suggestions?

@Tezinder : Did you enabled Advanced HTML CSS on Email Template? Would you be able to share the email template with masking the sensitive information?


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

@Saathvik Yes it is enabled.

Attaching the template and objectsummary file

@Tezinder : Instead of in to field can you put that in body and to field give your own email and see if email is triggering. If you still getting error please share the respective logs

Also can you explain how you are storing the value in PasswordEmail dynamic attribute? Is it hidden attribute or capturing request process or it has default value? If possible share the dynamic attribute configuration screenshot


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

dynamicAttrsList is not exposed in email TO /BCC/CC. Use variable in Email Body


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