Subcase - how to refer to containing "parent" case?
I have a sub-case defined, and am in the process of making up a decision table. However, one of the properties I need for this decision table resides not in the sub-case rule/object, but rather in the parent case. What is the syntax, when defining a decision table, of referring to the parent case instance?
I have searched both PDN and 7.1.7 help without any hits, before posting this question.
***Updated by moderator: Marissa to close post***
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
I learned something today! So, the parent / covering case is the "pyWorkCover". In addition, to use this in the decision table, I had to create a reference in the "Pages & Classes" tab. (Still not sure what is going on there, is this creating a new instance of pyWorkCover, or just referring to an existing one, and stating that it is of type XYZ?)
Yeah, the pages-and-classes tab only declares the type of page it is , and is useful for when you are editing the ruleform and for validation during save of the ruleform. It does not introduce any extra code during the running of the rule. /Eric
re: "is this creating a new instance of pyWorkCover, or just referring to an existing one..."
It assumes it exists. Typically, when a user opens a case, its parent will be opened in pyWorkCover. But that won't necessarily happen when agents or declarative rules access a case. And, unfortunately, there's no consistent behavior when a page is missing (I think Pega simply uses the primary page; it does not always throw a warning)
Has Pega ever considered that when pyWorkCover is referenced, and doesn't exist, it can load declaratively? That would be highly useful.
This has always really bothered me. My thought has always been that the parent case's info should be accessible to the child. If pyWorkCover always was actually populated, perfect. But because it is not, how WOULD we get to the parent's case data?
My solution is to create something like this:
MyApp-Work: has a page property called ParentInfo, of type MyApp-Data-License
MyApp-Work-Parent: inherits ParentInfo property
MyApp-Work-Child: inherits ParentInfo property
(Of course, "Parent" and "Child" aren't the actual names of my classes.)
MyApp-Data-Parenthas all the properties I need for the parent case. When the child case gets created, I just include Data Propagation to copy the parent's ParentInfo property over to the child's ParentInfo property (they both inherit this property from MyApp-Work). Now, the child has ALL the case data from the parent.
Some of you may consider this to be an awful approach. I would not disagree. However, I don't know what else to do. AND:
1) It works.
2) It is easy to set up.
3) It makes Data Propagation from parent to child class very easy (I'm not creating the same property in multiple classes and creating a big laundry list in my Data Propagation).
4) The parent's case data is stored in an actual property, not a clipboard page, so I don't have to set up the Page tab every time I need to use it.
5) I'm just building demos, so no harm no foul.
What would be the "correct" approach, or just a better approach in general? I am very open to feedback.
Hi Jim. You'd need to load up the parent in another page before using the decision rule, and if that page were called myParent, and you wanted to refer to property dateOfSale from the decision rule, you would refer to it as myParent.dateOfSale . You would also want to specify myParent and the correct class in the pages-and-classes tab.
To simplify your design to avoid having to do that, though, and for efficiency, you may want to consider having the dateOfSale property also exist in the child case so you don't even have to reach back into the parent for the information. /Eric