In a Pega Constellation application, we are cloning a Parent Job case (BR-Disclosure-Work-Job) from a Work Order table context (BR-Disclosure-Work-WorkOrder) via association.
To satisfy a business requirement, we create the cloned case inside the Flow Action Pre-Processing Activity so we can pass the NewlyClonedJobID property as a parameter to a Data Page and render the newly generated Case ID in the modal view before the user clicks Submit.
However, in Constellation, when the user submits the modal, the Flow Action’s pre-processing activity executes again before post-processing runs. This triggers second time, resulting in duplicate case creation errors.
-
Primary Context: Work Order table view (BR-Disclosure-Work-WorkOrder).
-
Target Case: Parent Job case (BR-Disclosure-Work-Job) linked via association.
-
Pre-Processing Logic: Executes pxCreateTopCase to generate the cloned Job case and we obtains the generated pyID / pzInsKey passing NewlyClonedJobID as a parameter to a Data Page to display the newly cloned Job ID directly in the modal view.
When the user completes the modal and clicks Submit, Constellation’s execution re-evaluates the Flow Action and runs the Pre-Processing Activity a second time before proceeding to post-processing. Because the activity executes again, it attempts to recreate the cloned case, causing duplicate database key / primary key insert failures.
Attempted Solutions:
Obj-Browse Database Checks:
- Attempted querying the database in Step 1 of the activity to check if the cloned Job already exists before executing pxCreateTopCase.
System Clipboard Flags (pxThread / pxRequestor):
- Attempted setting clipboard properties on pxThread or pxRequestor to track whether the clone was already generated. Constellation’s stateless REST API submission flushes/resets transient clipboard pages and parameters across the submit boundary.
Editable Data Page (Requestor Scope):
- Attempted storing NewlyClonedJobID in an Editable, Requestor-scoped Data Page (D_Page) to use as a guard condition (Exit Activity if D_Page.pyID is not blank). The DX API submission context flushes/re-initializes the Data Page state during the form submit API call, resetting the property to blank and failing the guard check.
I understand preprocessing is for initializing the values , but as per our business needs, we are ought a solution for this.
As per the business, to avoid many clicks on the screen, we need to create a new case on the pre-processing itself and we do not want to do it post processing and do not want a have a full component for this. What is the recommended Pega Constellation design pattern to handle case creation during modal launch when the newly cloned Case ID must be generated, passed via Data Page parameter, and displayed in the view prior to submission?
@MarcCheong - any thoughts on this?






