HTML Table formatting is not working as expected in the email body

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

Parents
  • Hey Harris

    Can you please share the steps to create the dynamic table inside the email body? That will be highly helpful.

    Thanks

  • 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

    Code:

    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"
    ),

    )
    )
    )

Reply Children
No Data