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

One Email Based on Choice From Repeating Section Data

Jump to solution

Hi,

I am able to get child items from parent list where i have a repeating section following: Repeating section as html table in mail. I am also able to filter repeating section data and put it into HTML. However, i am not able to send separate emails based on choice. Below is the scenario:

I have a choice field called company, and example choices are: 1, 2, 3, 4, 5, 6. I want to be able to send one email and the contents related inside the repeating section from company 1, 2, and 3 to one set of users, and the contents related inside the repeating section from company 4, 5, and 6 to another set of users. How do i accomplish this?

0 Kudos
Reply
5 Replies
Workflow Hero

Re: One Email Based on Choice From Repeating Section Data

Jump to solution

Hi Bright,

You'll have to query the XML output of the repeating section and write the XPath to return the values for each node.

If you save the Repeating section control to a plain text multi line column, you'll be able to query that columns values. 

I'm assuming the format will be pretty standard, so you can store the outputs for each row in a new collection. Search the collections at the same index for the Company value, and if that value is met, use a Conditional action to send the email to the appropriate recipient with the values from the collection. 

Thank you,

Sean

Reply
Workflow Hero

Re: One Email Based on Choice From Repeating Section Data

Jump to solution

Sean Fiene, The company are selected randomly, and are never same amount of rows in the repeating section.

0 Kudos
Reply
Workflow Hero

Re: One Email Based on Choice From Repeating Section Data

Jump to solution

Hi Bright,

No worries about the randomness of rows in the repeating section. You can do a count for particular nodes in the XML. From there, you'll run a for-each loop on the number of nodes.

0 Kudos
Reply
Workflow Hero

Re: One Email Based on Choice From Repeating Section Data

Jump to solution

Sean Fiene,

Below is what i have to create child items in another list, and send HTML email. The condition does not pass.

repeatingsectionemail

0 Kudos
Reply
Workflow Hero

Re: One Email Based on Choice From Repeating Section Data

Jump to solution

I figured this out.

I just had to add a xsl:if for each branches based on condition (companies), then insert run if action if the variable is not empty, and finally send email with that variable:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xslSmiley Surprisedutput method="html" />
<!-- transform repeating section from xml to html -->
<xsl:template match="/">
<xsl:if test="//Items/Item[Company='1' or Company='2' or Company='3' or Company='4' or Company='5' or Company='6']">
<table border="1" width="100%" style="border-collapse:collapse;background-color:azure;border:1px solid;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;">
<thead>
<tr>
<td>Company</td>
<td>First Name</td>
<td>Last Name</td>
<td>ID</td>
<td>Date</td>
</tr>
</thead>
<tbody>
<xsl:for-each select="//Items/Item[Company='1' or Company='2' or Company='3' or Company='4' or Company='5' or Company='6']">
<tr>
<td>
<xsl:value-of select="Company" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="FirstName" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="LastName" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="ID" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="Date" disable-output-escaping="yes" />
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Reply