cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Email Body for Email Notification in SAP BTP Workflow Management

sPatil
Participant
0 Kudos
909

Hi,

We want dynamic email body in our HTML file for the email notification in SAP BTP Workflow Management. To achieve the same, we are using a context variable ($.context.HTML_Block) which contains HTML block as below.

$.context.HTML_Block = `<br> <strong>ID: </strong> <a target="_blank" href="${context.Url}"

style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text decoration:underline;color:#3d85c6;font-size:14px"> ${context.Id}</a>`;

And the same context variable ($.context.HTML_Block), we are using in HTML file for email body. But this is giving an error during deploy.

Am I missing something here? Or there is any other way to achieve the same?

Thanks in advance!

Accepted Solutions (0)

Answers (2)

Answers (2)

smarchesini
Active Contributor
0 Kudos

After years, I finally found out the answer to your question and I shared the solution in this blog:
https://community.sap.com/t5/technology-blogs-by-members/quot-dynamic-quot-email-body-for-email-noti...

tobias_breyer
Advisor
Advisor
0 Kudos

Hi,

you will likely not achieve what you want at all with that approach. See

https://help.sap.com/docs/workflow-capability/workflow-cloud-foundry/configure-mail-tasks

> You can use expressions in the mail body and the subject. However, you cannot add HTML tags in the HTML mail body using expressions, because special characters in the expression results are escaped for security reasons.

This means for example that you cannot dynamically build an HTML table with the rows coming from array data. There might be ways of formatting to achieve a tabular display (e. g. pre-tag or perhaps some CSS mechanism), but you cannot build the mail HTML dynamically, introducing HTML tags through context expressions.

Regards,

Tobias