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.

Three outcomes, no new codeTry it: switch the PlanType and watch one paragraph change

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

  1. GenerateDocumentContent(DocumentID = DOC0003)
  2. Section LETTER_START: 1 paragraph row
  3. PR_Salutation: not conditional, include
  4. Section LETTER_BODY: 5 paragraph rows
  5. PR_BodyStandard: IsParagraphApplicable, row MembershipLevel = STANDARD is true, include
  6. PR_BodyGold: IsParagraphApplicable, no row matched, otherwise returns false, skip
  7. PR_Body_PayNow: IsParagraphApplicable, row PlanType = PAY_NOW is true, include
  8. PR_Body_Instalments: IsParagraphApplicable, no row matched, otherwise returns false, skip
  9. PR_Body_Hold: IsParagraphApplicable, no row matched, otherwise returns false, skip
  10. Section LETTER_END: 1 paragraph row
  11. 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.

  1. In Dev Studio: Create → User Interface → Paragraph.
  2. Save each to your work class, the same as in the paragraph rules chapter.
  3. Create PR_Body_PayNow, PR_Body_Instalments and PR_Body_Hold.
PR_Body_PayNow
<p><< pyWorkPage.CustomerName >>, your balance of << pyWorkPage.AmountDue >> is due now.</p>
PR_Body_Instalments
<p><< pyWorkPage.CustomerName >>, you are on an instalment plan. Your next payment is part of the << pyWorkPage.AmountDue >> total.</p>
PR_Body_Hold
<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:

New Document Content Paragraph rows
CodeSection nameParagraph IDSeqIs conditional
PAR0201LETTER_BODYPR_Body_PayNow3true
PAR0202LETTER_BODYPR_Body_Instalments4true
PAR0203LETTER_BODYPR_Body_Hold5true

Then add matching rows to your specialised decision table:

New IsParagraphApplicable decision table rows
Document IDSection nameParagraph IDpyWorkPage.PlanTypeReturn
DOC0003LETTER_BODYPR_Body_PayNowPAY_NOWtrue
DOC0003LETTER_BODYPR_Body_InstalmentsINSTALMENTStrue
DOC0003LETTER_BODYPR_Body_HoldHOLDtrue
otherwisefalse

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.

A hands-on guide by Sanjeev Kujur. Independent, and not affiliated with or endorsed by Pegasystems.

Tested against Pega Infinity v26 / Constellation v26 · Updated 5 Nov 2026