Chapter 04
Paragraph rules
The words live in Pega Paragraph Rules, and a decision table chooses which ones show. One small trick, the pyWorkPage prefix, causes most of the surprises.
Pega 24 – 26
Words you will meet
- Paragraph rule
- pyWorkPage
- IsParagraphApplicable
Phase 4 · Step 10
Create the paragraph rules.
- In Dev Studio:
Create → User Interface → Paragraph. - Save each rule to your work class:
MyApp-Work-PaymentReminder. - Use the
pyWorkPageprefix for every case property reference (explained below).
<p>Dear << pyWorkPage.CustomerName >>,</p><p>Yours sincerely,<br/>The ACME Team</p><p>Your bill of << pyWorkPage.AmountDue >> is now overdue. Please pay now.</p><p>We note your balance of << pyWorkPage.AmountDue >>. As a Gold member, please pay at your convenience.</p>Paragraph text is illustrative. The << … >> markers are where a case value is merged into the HTML.
The one trick
Why pyWorkPage?
The same applies to the decision table in the next step. Try it: untick the prefix on either one and watch what the letter does. These are the first two rows of the troubleshooting table, in action.
MembershipLevel on the case
Make a mistake on purpose
The letter on screen
Dear Sam Rivera,
Your bill of $120.00 is now overdue. Please pay now.
Yours sincerely, The ACME Team
What the engine did
- GenerateDocumentContent(DocumentID = DOC0003)
- Section LETTER_START: 1 paragraph row
- PR_Salutation: not conditional, include
- Section LETTER_BODY: 2 paragraph rows
- PR_BodyStandard: IsParagraphApplicable, row MembershipLevel = STANDARD is true, include
- PR_BodyGold: IsParagraphApplicable, no row matched, otherwise returns false, skip
- Section LETTER_END: 1 paragraph row
- PR_Closing: not conditional, include
The Paragraph table, and which rows made it in
- PAR0101LETTER_START · seq 1PR_SalutationincludedDear << pyWorkPage.CustomerName >>,
- PAR0102LETTER_BODY · seq 1PR_BodyStandardincludedYour bill of << pyWorkPage.AmountDue >> is now overdue. Please pay now.
- PAR0103LETTER_BODY · seq 2PR_BodyGoldskippedWe note your balance of << pyWorkPage.AmountDue >>. As a Gold member, please pay at your convenience.
- PAR0104LETTER_END · seq 1PR_ClosingincludedYours sincerely, The ACME Team
Illustrative: a simulation of the example in this guide, not a real Pega system.
Phase 4 · Step 11
Specialise the decision table.
The IsParagraphApplicable decision table controls which conditional paragraph shows, here based on MembershipLevel. You do not edit the original: you save a copy to your own class and ruleset.
- In Dev Studio, search for the rule
IsParagraphApplicable. - Click
Save asand save to your work class and ruleset. - Add the following rows to your specialised copy:
| Document ID | Section name | Paragraph ID | pyWorkPage.MembershipLevel | Return |
|---|---|---|---|---|
| DOC0003 | LETTER_BODY | PR_BodyStandard | STANDARD | true |
| DOC0003 | LETTER_BODY | PR_BodyGold | GOLD | true |
| otherwise | false |
Your turn
Questions and comments
Stuck on something, or have a thought? Write it here. To talk about one part, use the Comment button under that section's heading.