How do I script creating a table in a mail script?

Stacy1
Mega Guru

We would like to script the creation of a table in a mail script.  The reason I want to script it is I only want to add a row if there is a value for that particular variable.

The table should look something like this.  (If there is no Module then that row should not show up, etc.)

Thanks,

Stacy

Priority: current.priority
Product: current.product
Module: current.module
Activity: current.activity (if there was no data for this row I don't want this row to show)
Description: current.description
1 ACCEPTED SOLUTION

Stacy1
Mega Guru

I ended up not setting the font at all in my email script.

Instead I used a email layout and set the font there and called it in my email template.

Worked perfect.

View solution in original post

13 REPLIES 13

Yes I understand that and I have tried that accept it does not change the font in my table or the variables.

 

find_real_file.png

can you provide your complete code?

It will be faster to provide fix.

 

Regards,

Sachin

The rest of the code is just defining variables.  This is the only section that has anything to do with the printing part.  Here you go.

find_real_file.png

You can do something like below

 

template.print(current.getDisplayValue('cat_item') + "\n");


template.print('<table>');

template.print("<table style='width: 90%; color: #000000; font-family: arial, helvetica, sans-serif;   font-size:12px;'>");
template.print('<tr>');
template.print('<th style="width: 100px;">Question</th><th>Answer</th>');


      var vs = set.getFlatQuestions();


      for (var i=0; i < vs.size(); i++) {


              if(vs.get(i).getLabel() != '') {


  if (vs.get(i).getDisplayValue() != ''){


  template.space(4);