AnsweredAssumed Answered

Generate HTML with Dynamic Formatting for Send Notification

Question asked by kerrieb40 on Sep 27, 2017
Latest reply on Sep 28, 2017 by kerrieb40

Is it possible to dynamically format HTML in a Send Notification (email) action for Nintex Workflow 2016 on-prem? I have successfully created HTML output.  The requirement I'm stuck on is to be able to change the font-color/background-color on inserted reference (field values) based on a condition.

 

Example:

If valueA != valueB, then add a CSS class to the <td> tag.  The CSS class would apply the appropriate styling.

 

Embedding the CSS directly does not render correctly as it outputs the code into the email.  If I link to a CSS file within the HTML, nothing happens.  I also have a link to a jquery library, and then have a small script to run to insert the class on the td.  Everything works well when testing with Visual Studio.

 

I have tried to insert the HTML directly in the Send Notification (Edit Source) and I have also tried to use the Build String and then insert the variable in the Notification instead. 

 

Script:

<script>

$(document).ready(function () {

$('tbody tr td:not(":first")').each(

function () {

if (curr != prev) {

$(this).addClass('changed');

}

});

});

</script>

 

Table portion of the code:

<table>

<col id="curr"/>

<col id="prev" />

<thead>

<tr>

<th>Current</th>

<th>Previous</th>

</tr>

<tbody>

<tr>

<td class="changed">100000</td>

<td>200000</td>

</tr>

<tr>

<td>200000</td>

<td>200000</td>

</tr>

<tr>

<td>01/01/2018</td>

<td>01/01/2019</td>

</tr>

</tbody>

</thead>

</table>

Outcomes