How to Loop Through a PageList in a Correspondence Rule in Pega

How to Loop Through a PageList in a Correspondence Rule in Pega

In Pega, Correspondence rules are primarily used to generate and send emails, SMS, or printed letters. Often, while constructing correspondence, you may need to loop through a PageList to generate content dynamically. This article explains how to efficiently loop through a PageList in a Correspondence rule using the "forEach JavaServer Page tag".

What is a PageList in Pega?

A PageList in Pega is a clipboard property used to hold a collection of items, where each item is an instance of a data type or class. For example, in the context of a purchase scenario, a PageList named PurchaseList can store the details of multiple purchased products. Each entry in the PageList represents one product and contains properties such as the Product Name, Quantity, and Price.

Use Case Example

Imagine you're building an application where you need to email a client, listing all the purchased products. The product details are stored in a PageList property called PurchaseList.

Example Configuration

Below is a sample structure for an email correspondence rule:

Hello <pega:reference name=".CustomerName" />,

Here are the details of your recent purchases:

<TABLE border="1" cellpadding="5" cellspacing="0">
    <TR>
        <TH>Product Name</TH>
        <TH>Quantity</TH>
        <TH>Price</TH>
    </TR>
    <pega:forEach name=".PurchaseList">
        <TR>
            <TD><pega:reference name="$THIS.Name" /></TD>
            <TD><pega:reference name="$THIS.Quantity" /></TD>
            <TD>$<pega:reference name="$THIS.Price" /></TD>
        </TR>
    </pega:forEach>
</TABLE>


Thank you for your purchase!

Best Regards,  
Your Company        

Example Output for the PageList:

If the PurchaseList contains the following data:

Output for the forEach code


Ravi Krishna Ladi

Coverage Review Determination (CRD) Specialist | Lead Pega Solutions Consultant at Evernorth Health services -Express scripts/The Cigna Group

2 个月

Useful tips

回复
Sai Manohar Atmuri

Pega Constellation | Pega Infinity | CRM | CSA |CSSA|Ex Pegasystems | Andhra University Alumnus

3 个月

Useful tips

回复
Jaswanth M

?? Software Engineer | Pega Certified Senior System Architect | AI & Automation | Java | React | Cloud & DevOps | Digital Transformation Expert | Azure

3 个月

Very informative & eagerly waiting for this kind of knowledge sharing by you...!!!

Zumry Amanullah

Software Engineer at virtusa | Pega CSSA | Pega CSA

3 个月

Very informative ??

要查看或添加评论,请登录

Mohamed Akeel的更多文章

社区洞察

其他会员也浏览了