Chapter 06
Many variants
Two outcomes were easy. Five are just as easy: the activity never changes, and you only add paragraph rules, paragraph rows and decision table rows.
Pega 24 – 26
Words you will meet
- Decision table
- Conditional paragraphs
- Tracer
Phase 6
The pattern that scales.
The GOLD and STANDARD example uses one field with two values. The same pattern scales to any number of values. Here it is with a PlanType field that has three outcomes: PAY_NOW, INSTALMENTS and HOLD. Nothing about LoadDocumentContent or GenerateDocumentContent changes.
MembershipLevel on the case
PlanType 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.
Sam Rivera, your balance of $120.00 is due 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: 5 paragraph rows
- PR_BodyStandard: IsParagraphApplicable, row MembershipLevel = STANDARD is true, include
- PR_BodyGold: IsParagraphApplicable, no row matched, otherwise returns false, skip
- PR_Body_PayNow: IsParagraphApplicable, row PlanType = PAY_NOW is true, include
- PR_Body_Instalments: IsParagraphApplicable, no row matched, otherwise returns false, skip
- PR_Body_Hold: 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.
- PAR0201LETTER_BODY · seq 3PR_Body_PayNowincluded<< pyWorkPage.CustomerName >>, your balance of << pyWorkPage.AmountDue >> is due now.
- PAR0202LETTER_BODY · seq 4PR_Body_Instalmentsskipped<< pyWorkPage.CustomerName >>, you are on an instalment plan. Your next payment is part of the << pyWorkPage.AmountDue >> total.
- PAR0203LETTER_BODY · seq 5PR_Body_Holdskipped<< pyWorkPage.CustomerName >>, your account is on hold. No payment is needed for now on the << pyWorkPage.AmountDue >> balance.
- PAR0104LETTER_END · seq 1PR_ClosingincludedYours sincerely, The ACME Team
Illustrative: the field, values and wording are an example, and this is a simulation, not a real Pega system.
Phase 6 · Step 14
One rule per outcome.
- In Dev Studio:
Create → User Interface → Paragraph. - Save each to your work class, the same as in the paragraph rules chapter.
- Create
PR_Body_PayNow,PR_Body_InstalmentsandPR_Body_Hold.
<p><< pyWorkPage.CustomerName >>, your balance of << pyWorkPage.AmountDue >> is due now.</p><p><< pyWorkPage.CustomerName >>, you are on an instalment plan. Your next payment is part of the << pyWorkPage.AmountDue >> total.</p><p><< pyWorkPage.CustomerName >>, your account is on hold. No payment is needed for now on the << pyWorkPage.AmountDue >> balance.</p>Phase 6 · Step 15
Add the rows.
Add one Paragraph row per outcome, all in the same section, all conditional:
| Code | Section name | Paragraph ID | Seq | Is conditional |
|---|---|---|---|---|
| PAR0201 | LETTER_BODY | PR_Body_PayNow | 3 | true |
| PAR0202 | LETTER_BODY | PR_Body_Instalments | 4 | true |
| PAR0203 | LETTER_BODY | PR_Body_Hold | 5 | true |
Then add matching rows to your specialised decision table:
| Document ID | Section name | Paragraph ID | pyWorkPage.PlanType | Return |
|---|---|---|---|---|
| DOC0003 | LETTER_BODY | PR_Body_PayNow | PAY_NOW | true |
| DOC0003 | LETTER_BODY | PR_Body_Instalments | INSTALMENTS | true |
| DOC0003 | LETTER_BODY | PR_Body_Hold | HOLD | true |
| otherwise | false |
Checking your work
See which paragraph fired.
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.