Add a Subcase to the Covered work of a Case without opening it
In the CPM Interaction Portal, I have a Case "A" and I need to add a subcase "B" to the list of the Covered work of my Case "A" and automatically fill its properties without explicitly opening the Subcase "Create screen".
I only need it to be added to the list of covvered work: the user shouldn't see the screens of the subcase.
This should be done in an activity.
I called the activity "pxAddChildWork" in my Activity to create the subcase, then called "DoClose" activity to close it, but instead it deletes it.
Anyone has an idea about how to corretly obtain this behavior?
In the case type rule you can configure automatic instantiation of coverable work types (sub-cases). Including the conditions and dependancies for instantiation and data propagation.
Sounds like that may be the best bet for what you are looking to do.
This is from the latest Pega Platform Help to get you started. Full disclosure that I am not as familiar with CPM, my assumption is, at the very least, the concept is the same. If someone with more CPM knowledge believes this is off-track, please jump in on this.
pxAddChildWork api creates the Sub case B and runs the case till it finds an assignment. So the assign page of the parent Case A is overridden by that of the sub case B and your are seeing the child case assignment.
One way of fulfilling your requirement is to take back up of newAssignpage before calling pxAddChildWork api and restore it after the call to api. You can refer pxCreateTopCase api where we have used a similar fix.