Hi All,
I'm using the below rule (rule containing HTML code) to generate a dynamic table inside the email body. But the tabe format is not working as expected.
Code:
a!localVariables( local!taskData: rule!HD_getTaskDetailsByAssignee(activestatus:1, assignee:ri!assignee).data, concat( { "<h3> Tasks Due-today </h3>", "<p><br><table style=""width:100%; border:1px solid black"">", rule!HD_htmlCreateTableRow( values: { "Legal Entity Name", "Legal Entity ID", "Line Of Business", "Reporting Type", "Task Name", "Task due date", "Task generated date", "Task Link"
}, isBold: true ), a!forEach( items: local!taskData, expression: { concat( "<tr><td>", fv!item.c41, "</td><td>", fv!item.c35, "</td><td>", "</td><td>", fv!item.c39, "</td><td>", "</td><td>", fv!item.c36, "</td><td>", "</td><td>", fv!item.c41, "</td><td>", "</td><td>", fv!item.c47, "</td><td>", "</td><td>", fv!item.c50, "</td><td><a href=", cons!CCAR_ENV_USER_TASK_LIST_URL, ">Task Link</a>", "</td></tr>" ) } ), "</table></p>","<h3> </h3>"},))
Table format Screenshot:
Thanks
Discussion posts and replies are publicly visible
If you save the text output of the rule to a new .html (text) file then open that in a web browser, does it display correctly there? That's the first thing I'd suggest (if you haven't already) in terms of troubleshooting this.
Between some of your items in a!foreach() you have:
"</td><td>","</td><td>",
This is creating extra grid cells, pushing the data out to the right. Note the first 2 columns contain a single "</td><td>" between them, and display correctly in your screen shot:
fv!item.c41,"</td><td>",fv!item.c35,
It appears that removing the duplicate "</td><td>" lines between your fv!item data will resolve the issue.
Issue Sorted now,
Many thanks Chris.
Hey Harris
Can you please share the steps to create the dynamic table inside the email body? That will be highly helpful.
Hey st07,
I have created a rule which contains the HTML code which generates a dynamic table. I have pasted my code below.
In the process Model you need to save the output of this rule in a PV and call the same PV in Email body.
Hope it helped you
a!localVariables( local!taskData: rule!HD_getTaskDetailsByAssignee(activestatus:1, assignee:ri!assignee).data, joinarray( append( {/*"<table border=1>*/ "<table style=""width:700px;"" border=""1""> <tbody><tr><td><strong>Legal Entity Name</strong></td><td><strong>Legal Entity ID</strong></td><td><strong>Line Of Business</strong></td><td><strong>Reporting Type</strong></td><td><strong>Task Name</strong></td><td><strong>Task due date</strong></td><td><strong>Task generated date</strong></td><td style=""width: 100px;""><strong>Task Link</strong></td>
</tr>" }, { a!forEach( items: local!taskData, expression: { concat( "<tr><td>", fv!item.c38, "</td><td>", fv!item.c35, "</td><td>", fv!item.c39, "</td><td>", fv!item.c36, "</td><td>", fv!item.c51, "</td><td>", fv!item.c47, "</td><td>", fv!item.c50, "</td><td><a href='", cons!CCAR_ENV_USER_TASK_LIST_URL, "'>", "Task Link", "</a></td></tr>" ) } ), "</table>" }, "<br> </br>", rule!HSBC_UT_htmlCreateLink( url: cons!CCAR_ENV_USER_TASK_LIST_URL, label: " Click Here to Navigate to My Tasks" ), ) ))
Thank you so much .