I am trying to create a child case when a local action is submitted. The local action is opened in a modal dialog, and upon submission, the case should be created under the current parent case.The local action is configured in a data context, I implemented a activity to create the case. However, when I submit the local action, I got an error. It is working when i use the same activity in post processing of flow action (main flow).
Could you please help me understand what might be causing the issue and whether creating a child case from a local action in a data context is a supported approach? I have attached the activity configuration and the error details for reference.
Architecture?
Is this Constellation? It looks like it, but thought I would check. Which version of Pega?
Creating cases
Generally, if you want to create a case in the context of data you should be using Configuring Actions for data objects - Knowledge Share - Pega Forums - this would be via a Create Case shape in the action. Which would be using Pega’s Automation for this, not an activity.
My experience with create case activities (there are many of them), inside Theme-Cosmos and Constellation has been varied. Not all of them are usable for this design system. Again, why I always stick with create case shape.
The fact you are calling pyWorkPage, pretty much won’t work in Constellation - given the stateless nature of the architecture, I’m not sure it will work as intended. It could but most likely won’t
Business outcome
Could you share more on your business outcome and your configuration?
- You’re trying to create a case at the embedded data level?
- Via a local action? Is this a case wide action (actions menu) or embedded data action?
What I am imagining is an action on my case called “create case” and I enter some details then pass that on to the child case created? If so, I would be using a flow instead, then you can utilise the create case utility shape to create your case AND that will also redirect your UI appropriately (as I said, mixed experiences with activities that don’t do this)
Example implementation
This was created for customer service but works much the same for Infinity. Launching a Case from an existing Service Case in Pega Customer Service
Its constellation,my scenario is that i have a embedded list where i ll have list of items i can edit a record once submit the modal dialog case should be created. The same activity is working fine when i called it in post processing of the screen (screen where i have actual embedded list parent case). The approcah you mentioned to use flow, my question is will it create case for the same parent work object which i m currently in?
Ah ok, this is embedded data. Then please ignore my solution with a flow, that was purely looking at case wide actions like this:
Embedded data
For context, you’re talking about this screen? Embedded data, when I click the add item button, I get an action. Upon submit (green highlight), you are creating the case?
I would not be looking to create a child case from embedded data upon submission of the modal. That embedded data is not saved, it is still only data on the client side, it has not been saved to the server. This could be one of the reasons your create case isn’t working.
The fact this isn’t saved, as a user I could click cancel on my main case assignment, and that data would disappear, but you’ve created a case for me. Auditing this, there would be no record of anyone asking for that case to be created.
Placing the creation of the case upon submit of the assignment (not the action in embedded data) is the right way to go here.
Yeah if this doesn’t work thats the proposed solution, but if you see the error it was like some other user updated. i believe it is not bcs of data being persist to server or client right? maybe some lock has lost?
In Constellation architecture, the processing is likely multiple threads:
- The user holds the lock on the case, clicks submit and updates the embedded data
- The activity is attempting to create a child case (which attempts to obtain the lock on the case)
I am no aware of anyway around this for a child case.
You could test creating a spinoff/top level case? I suspect that would work because there would be no clash here.
However, I still would not attempt that, given embedded data is transitory until submitted. We didn’t discuss, what happens if user deletes an embedded data line? You have no way to delete that case now, not until post processing of the top level assignment…
I believe you’ve Optimistic locking. Also, why do you need to create the child cases from Option actions?
Could you please check with the locking strategy to Default?