Loop Through Multiple Custom Objects Syntax?
Hello!
Super basic question here but have a situation where I need to loop through two separate custom objects and the output based on criteria from both objects.
Looking mostly for the best way to set a variable if the initial if statement is true and then referencing that variable in the next if statement within the second object loop?
Here is my current working script:
#foreach( $item in $customerProfilesList )
#if ( ($item.membershipStatus.equals("Member")) && ($item.customerType.equals("PERSON")) && ($item.age >= 18) && (!$item.membershipDate.isEmpty()) )
#set ( $leadIsMember = "1" )
#else
#end
#end
#foreach ($item in $customerDepositsList)
#if ( ($leadIsMember.equals("1")) && ($item.HYCStatusEndMonthDate.IsEmpty() ) )
<table width="100%" style="width: 100%;">
<tbody>
<tr>
<td style="padding: 5px;">
<h2 style="font-family: 'Poppins', Arial; text-align: center; font-weight: normal; color: #003087; font-size: 24px; line-height: 26px;">Get faster & easier access with eDocuments.</h2>
<p>Cut the paper clutter! Sign up for eDocuments to receive your statements and notices faster and more securely in digital banking.</p>
<ul>
<li>24/7 statement access and availability</li>
<li>Common tax documents such as Form 1098, 1099 and 5498</li>
<li>Account notices including return items/overdraft notices, late notices and more</li>
<li>Go Paperless</li>
</ul>
</td>
</tr>
<tr>
<td>
<table align="center">
<tbody>
<tr>
<td style="padding: 17px; max-width: 100%; text-align: center;"></td>
<td style="padding: 17px; max-width: 100%; background-color: #0071ce; color: #ffffff; border-radius: 6px; text-align: center; font-family: 'Poppins', Arial; font-size: 16px; font-weight: bold; line-height: 120%; margin: 0; text-decoration: none; text-transform: none;"><a href="https://digital.wingscu.com/documents/base-paperless-settings"> <span style="color: #ffffff;">Go Paperless</span></a></td>
<td style="padding: 17px; max-width: 100%; text-align: center;"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
#break
#else
#end
#end