Posted: 15 Jan 2019 18:57 EST Last activity: 4 Feb 2019 3:19 EST
Issue with duplicate case after resolve of child case
I'm working on Pega 7.2.1 and I have following scenario to implement
I have a "Contract" case which have a child case "Recycle". In a flow I have to create child case and based of the option chosen by the user process the parent case in two different ways. First option is to restart previous "Contract" stage and the second one is to Cancel current Contract case and creates its duplicate.
1st scenario works fine but I have problems with the second one.
I used OOTB shape to create child case, then wait shape to wait for resolved child, decision shape to choose path (user option from child case) and - duplicate (copyWork activity) and change stag shape to complete case in "cancelled" stage.
I got two main problems with this approche:
1. I got locking issue - child case loose its lock and cannot be saved - it ends unresolved even if was resolved during the flow processing (wait shape resumes the flow)
2. duplicated contract is created as child of original contract instead of it's sibling.
For the first issue, is the lock always gone at that point? Have you tried adding a call to the Obj--Refresh-And-Lock method after the lock is returned (presumably after a commit)? That should get you your lock back and allow you to move forward.
For the second issue, I assume that you are still in the first child context when you spin off the second. I'd want to look at a trace and pay close attention to that. If I were guessing, you need to get the parent back onto the pyWorkPage, before spinning off the new sibling, though I haven't actually taken a look at how this works under the covers, so there may be some other mechanism used to define the appropriate parent.
It's not so simple as both issue are related witch each other.
1. I've already tried to add refresh lock in different places, but nothing helps. Lock is released in one of OOT actvities inside copyWork activity.
2. To be clear there is only one Child case.
I guess problem is with context. Once Child case is resolved and process back to parent case, next rules are processed in on pxWorkCover instead of pxWorkPage. So it seems as it's still in context of child case and not really back to parent.
When i add dummy assignment shape just after wait shape the context is moved to parent and everything works as expected.