cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Workflow Email Notifications - Table Row Tags <TR> Getting Stripped

TomU
23-Emerald IV

Workflow Email Notifications - Table Row Tags <TR> Getting Stripped

I am working on customizing the promotion request workflow to automatically include a simple HTML table with the promotion objects listed in the email notifications.  The logic in the workflow seems to be okay, and the debug statements look fine in the method server log, but the actual email that gets sent out has all of the table row tags (<tr> and </tr>) stripped from it.

 

I've tried sending emails to both internal and external users and it didn't make any difference.  Any idea why this might be happening?

 

Workflow Expression:

String style = "style=\"border: 1px solid black; padding: 5px\"";

promotion_objects = "<table style=\"font-size: 14px; color: #464646; font-family: helvetica,arial,sans-serif,Segoe UI,tahoma; border-collapse: collapse\">\r\n";

wt.maturity.StandardMaturityService p = new wt.maturity.StandardMaturityService();
wt.maturity.PromotionNotice pn =(wt.maturity.PromotionNotice)primaryBusinessObject;
wt.fc.QueryResult pn_targets;
pn_targets = (wt.fc.QueryResult) p.getBaselineItems(pn);
wt.epm.EPMDocument epmDoc = new wt.epm.EPMDocument();
while (pn_targets.hasMoreElements())
{
     Object obj =pn_targets.nextElement();
     String objType =obj.getClass().getName();
     if (objType.equals("wt.epm.EPMDocument"))
     {
         epmDoc = (wt.epm.EPMDocument)obj;
         System.out.println("state = " + epmDoc.getState().toString());
         System.out.println("number = " + epmDoc.getNumber().toString());
         System.out.println("cadname = " + epmDoc.getCADName());

         promotion_objects = (promotion_objects + "<tr>\r\n");
         promotion_objects = (promotion_objects + "<td " + style + ">" + epmDoc.getNumber().toString() + "</td>\r\n");
         promotion_objects = (promotion_objects + "<td " + style + ">" + epmDoc.getState().toString() + "</td>\r\n");
         promotion_objects = (promotion_objects + "<td " + style + ">" + epmDoc.getCADName() + "</td>\r\n");
         promotion_objects = (promotion_objects + "</tr>\r\n");

     }
}

promotion_objects = (promotion_objects + "</table>");

System.out.println(promotion_objects);

 

From the method server log:

state = INWORK
number = COOLING_DUCT.ASM
cadname = cooling_duct.asm
state = INWORK
number = CREO_INLBS_SOLID.PRT
cadname = creo_inlbs_solid.prt
state = INWORK
number = CREO_DEFAULT_INLBSEC.PRT
cadname = creo_default_inlbsec.prt
state = INWORK
number = DAYTON_THREAD_FORM_MATRIX.PRT
cadname = dayton_thread_form_matrix.prt

<table style="font-size: 14px; color: #464646; font-family: helvetica,arial,sans-serif,Segoe UI,tahoma; border-collapse: collapse">
<tr>
<td style="border: 1px solid black; padding: 5px">COOLING_DUCT.ASM</td>
<td style="border: 1px solid black; padding: 5px">INWORK</td>
<td style="border: 1px solid black; padding: 5px">cooling_duct.asm</td>
</tr>
<tr>
<td style="border: 1px solid black; padding: 5px">CREO_INLBS_SOLID.PRT</td>
<td style="border: 1px solid black; padding: 5px">INWORK</td>
<td style="border: 1px solid black; padding: 5px">creo_inlbs_solid.prt</td>
</tr>
<tr>
<td style="border: 1px solid black; padding: 5px">CREO_DEFAULT_INLBSEC.PRT</td>
<td style="border: 1px solid black; padding: 5px">INWORK</td>
<td style="border: 1px solid black; padding: 5px">creo_default_inlbsec.prt</td>
</tr>
<tr>
<td style="border: 1px solid black; padding: 5px">DAYTON_THREAD_FORM_MATRIX.PRT</td>
<td style="border: 1px solid black; padding: 5px">INWORK</td>
<td style="border: 1px solid black; padding: 5px">dayton_thread_form_matrix.prt</td>
</tr>
</table>

line 1 column 1 - Warning: plain text isn't allowed in <head> elements
line 26 column 1 - Warning: inserting missing 'title' element
InputStream: Document content looks like HTML 4.01 Transitional
2 warnings, no errors were found!

What the table should look like:

table.PNG

 

What actually shows up in the email message:

table_actual.PNG

 

Email Source:

</p><table style="font-size:14px;border-collapse:collapse">
  
    <tbody><tr><td style="border:1px solid black;padding:5px">COOLING_DUCT.ASM</td>
    <td style="border:1px solid black;padding:5px">INWORK</td>
    <td style="border:1px solid black;padding:5px">cooling_duct.asm</td>
  
  
    <td style="border:1px solid black;padding:5px">CREO_INLBS_SOLID.PRT</td>
    <td style="border:1px solid black;padding:5px">INWORK</td>
    <td style="border:1px solid black;padding:5px">creo_inlbs_solid.prt</td>
  
  
    <td style="border:1px solid black;padding:5px">CREO_DEFAULT_INLBSEC.PRT</td>
    <td style="border:1px solid black;padding:5px">INWORK</td>
    <td style="border:1px solid black;padding:5px">creo_default_inlbsec.prt</td>
  
  
    <td style="border:1px solid black;padding:5px">DAYTON_THREAD_FORM_MATRIX.PRT</td>
    <td style="border:1px solid black;padding:5px">INWORK</td>
    <td style="border:1px solid black;padding:5px">dayton_thread_form_matrix.prt</td>
  
</tr></tbody></table>
ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
olivierfresse
15-Moonstone
(To:TomU)
TomU
23-Emerald IV
(To:olivierfresse)

Thank you for the link.  Using that information I was able to make it work. Smiley Happy

 

It wasn't that I was using unsupported tags but rather that Windchill is choosing to strip <tr> tags that aren't placed inside a <tbody> block.

 

<table style="font-size: 14px;border-collapse: collapse;">
  <tbody>
    <tr>
      <td style="border: 1px solid black; padding: 5px;">COOLING_DUCT.ASM</td>
      <td style="border: 1px solid black; padding: 5px;">INWORK</td>
      <td style="border: 1px solid black; padding: 5px;">cooling_duct.asm</td>
    </tr>
    <tr>
      <td style="border: 1px solid black; padding: 5px;">CREO_INLBS_SOLID.PRT</td>
      <td style="border: 1px solid black; padding: 5px;">INWORK</td>
      <td style="border: 1px solid black; padding: 5px;">creo_inlbs_solid.prt</td>
    </tr>
    <tr>
      <td style="border: 1px solid black; padding: 5px;">CREO_DEFAULT_INLBSEC.PRT</td>
      <td style="border: 1px solid black; padding: 5px;">INWORK</td>
      <td style="border: 1px solid black; padding: 5px;">creo_default_inlbsec.prt</td>
    </tr>
    <tr>
      <td style="border: 1px solid black; padding: 5px;">DAYTON_THREAD_FORM_MATRIX.PRT</td>
      <td style="border: 1px solid black; padding: 5px;">INWORK</td>
      <td style="border: 1px solid black; padding: 5px;">dayton_thread_form_matrix.prt</td>
    </tr>
  </tbody>
</table>

 This is kind of odd because the <tbody> block is normally considered optional.  Oh well.  Thank you!

 

Now on to the next question - how to access revision, iteration, and url for EPM Documents.

Announcements

Top Tags