Handling Multi-Level Shareholder Structure with Validations in Pega Constellation

Hello everyone,

Requirement

I am trying to implement a hierarchical (multi-level) shareholder structure in Pega Constellation where users can define shareholders and their nested sub-shareholders.

Each Shareholder has the following fields:

  • Name
  • Type (Individual / Corporate)
  • Share Percentage

Business Rules / Validations

  1. No shareholder can have more than 100% share.
  2. The sum of sub-shareholders must equal the parent shareholder’s percentage.
  3. Individual shareholders cannot have sub-shareholders.
  4. Corporate shareholders can have sub-shareholders.
  5. All leaf-level shareholders must be Individuals (no Corporate at leaf level).

Functional Expectations

  • Users should be able to dynamically add nested shareholders (multi-level hierarchy).
  • Validations should be enforced before submission.
  • On submission, the entire hierarchy should be persisted to the system of record.
  • The saved data should be retrievable later for viewing and further processing.

Current Implementation

  • Using nested embedded Page Lists to represent hierarchy.
  • Implemented UI using modal dialogs.

Approach 1: View-type modal

  • Able to add nested shareholders successfully.
  • However, unable to perform certain validations during modal submission (no post-processing hooks available).

Approach 2: Action-type modal

  • Added Flow Action with pre- and post-processing for validations.

  • Encountering runtime error while submitting:

specified stack frame ‘listlist’ does not match top of stack: ‘viewview’
  • Due to this error, case creation fails.

Questions

  1. What could be the reason for the stack frame error (listlist vs viewview) when using Action-type modal in Constellation?
  2. Is there a recommended way to perform complex validations (like hierarchical percentage checks) when using View-type modals?
  3. What is the best-practice approach in Constellation to:
    1. Capture hierarchical data like this
    2. Enforce cross-level validations
    3. Persist the structure cleanly to a System of Record?
    4. Are there alternative design patterns (e.g., data transforms, validate rules, client-side validations, DX components) that would better suit this use case?

Additional Context

  • Using Constellation UI

  • Requirement involves both UI-level validations and post-submit consistency checks across hierarchy

Any suggestions on this topic is highly appreciated

Regards

JC

@JayachandraSiddipeta Are you doing anything “fancy” in the action based modal post-processing? I have never seen that error before, and instinctively I feel there should be few problems with using the action based modal approach.

@LantzAndreas Nothing fancy in the preprocessing nor in the action tab of the flow action. Just having pagelist inside a pagelist (of same data class). Only the post processing has the validations which i have mentioned.

The error comes mostly with the first level embedded property included in the data class view in the action. If i remove that then i don’t see this error.

It’s strange to me as well as i am seeing this kind of error for the first time. Could be because of having the list inside a list of same data class. But still trying to understand

Regards

JC

@JayachandraSiddipeta Ok, then I’m not sure. I don’t think there should be anything wrong with having a list in list of the same object. I was even going to suggest running a recursive-type validation for the structure. Easiest would be to do it post-assignment at once, but if you do need to run something on post-process for the modal, below are things that could help in validating the current page vs other pages:

  • Param.InterestPage - The page context of the current index you have open in the modal
  • @pxGetListSubscript(tools) - Returns the index of the item you have open in the modal

Just to check, does this run fine without your “nothing fancy” pre/post processing? That error sounds like an issue with data structure and views?

I recently had something similar when i accidently built a view/data model with circular references. I can’t remember the exact error, so hard to compare one to one. Thought it was my DT’s but it was just poor data modelling and view configuration :laughing: