Chapter 19
The playbook
A page to come back to. Every situation a custom component meets, told as what happens, which calls it makes, what Pega must provide, and the workaround for the trap that bit us.
Pega 24 – 26
Words you will meet
- Recipes
- Error codes
- Debugging
Read this first
Arrive with a situation.
You will not read this top to bottom. You will arrive with a button that must open a form, a table that is too slow, a data page that returns nothing. Search for the word, or pick a family, and open the card that matches.
Each card has the same shape: the situation, how it goes step by step, the calls it uses, what Pega needs ready, and the workarounds. The steps come from reading how the components in a real library actually run, not only from their documentation.
Reference
Every scenario.
27 of 27 scenarios
A button on a screen should open another Pega form in a dialog.
How it goes
- The author creates a Local Action rule on the case type, with the form to show.
- The author drops the button on a view and sets the Local Action ID, a heading and a type.
- On click the component checks it is enabled and has an action id, then reads the heading (typed as a constant, or read from a property with getValue).
- It opens the action in the modal container. Pega owns the dialog, the form, validation and submit.
Calls it uses
getActionsApi().openLocalActiongetValue
Pega needs
A Local Action rule
Shape of the code await pConn.getActionsApi().openLocalAction('EditDetails', { containerName: 'modal', type: 'Express', actionTitle: heading, itemKey: value || caseID,});Workarounds and traps
- The component never builds the modal. It only says “open action X in the modal container”.
- type is one of Case, Stage, Assignment or Express. refreshConditions only applies to Express and is a list of { field, event } pairs.
- Refresh conditions are accepted loosely: an array, a JSON string, a single object, or just a property name (which becomes { field, event: "Changes" }).
- A launching flag blocks a second click while the first is opening. It is released when the promise settles, so a failed open can be retried, and a rejected promise is reported instead of vanishing.
- Pega hides the field itself when its “when” condition fails (visibility === false), so the component simply renders nothing.
- The record to open on is the button’s value, or the caseID if there is no value.
- Guard it: pConn?.getActionsApi?.()?.openLocalAction?.(…) so Storybook and older Infinity versions do not throw.
Debugging
When something is wrong.
Start from what you see. The right-hand card says what to try.
Symptom
A button shows a red banner with a reference
Try this
Look the code up in the error codes tab. The console has the same code with a safe cause.
Look it up
Error codes.
Each failure carries a stable code, so the message a person sees can stay short and calm while support still knows exactly what happened. The same code appears in the browser console with a safe cause.
BAD-JSON
A setting contains invalid JSON and was ignored.
- Usual cause
- Typo in a Columns, Filters or Params setting.
- Fix
- Fix the JSON in App Studio.
NO-SETTING
A required setting is missing.
- Usual cause
- Empty Local Action ID, Data Page Name or URL property.
- Fix
- Fill the setting.
NO-RUNTIME
Pega runtime (PCore) is not available.
- Usual cause
- Running outside Pega, such as Storybook or tests.
- Fix
- Test inside Pega.
NOT-SUPPORTED
Action not supported by this Pega version.
- Usual cause
- An API is missing on this Infinity version.
- Fix
- Check the version and typedefs.
LOAD-FAILED
Data could not be loaded.
- Usual cause
- Server error, wrong name or parameter, network.
- Fix
- Run the data page in Dev Studio and read the network tab.
NO-ACCESS
No access to this data.
- Usual cause
- HTTP 401 or 403.
- Fix
- Check access group and privileges.
NOT-FOUND
Data source not found.
- Usual cause
- HTTP 404, wrong data page name.
- Fix
- Fix the name or deploy the rule.
BAD-REPLY
Unexpected response.
- Usual cause
- Reserved; a result field was missing in a result check.
- Fix
- Check the response shape.
SAVE-FAILED
Changes could not be saved.
- Usual cause
- saveData failed on a Savable page.
- Fix
- Check Savable mode and access.
ACTION-FAILED
Action could not be completed.
- Usual cause
- A case or container action was rejected.
- Fix
- Read the console summary.
NO-CASE
Current case or task could not be identified.
- Usual cause
- Button used on a page with no assignment.
- Fix
- Place it on a task screen.
RENDER-FAILED
This component could not be displayed.
- Usual cause
- Something threw while drawing; the error boundary caught it.
- Fix
- Fix the setting or data; the rest of the page is unaffected.
Keep going
Go deeper.
- Data page callsParameters, queries, sorting and paging, with a workbench.Open →
- Tables, grids and searchPick a pattern, start from a skeleton, see how interactive tables and search tables work.Open →
- Inside the componentsThe order of steps, safeguards and workarounds in buttons, layouts and displays.Open →
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.