@LakshmanKumarThotaWe have encountered the same situation in one of our application.
There are two ways to solve this problem
Option1 : Using pyDefault
You can write a pyDefault data transform in you embedded data class (Event) and set the .ParentTicketType = pyWorkPage.TicketType
This data transform will execute when you click the Add Event button on the embedded table and pull the Workpage TicketType property and set it to your new data object context which you can use a parameter to send to the Events data page to fetch the relevant events.
If you directly pass pyWorkPage.TicketType to the Events data page on the property definition, it will not work. So you have to rely on the pyDefault DT.
Pitfall in this approach is that you have to hardcode the pyWorkPage to get the work case context. There is a parameter “workPage” with value “pyWorkPage” passed to your DT automatically, but somehow i was not able to get the work case context page using that param. You can explore more here and if you find a solution without hardcoding, let us know.
You may want to write conditions before you use pyWorkPage for its existence using PageExistsWithClass(Param.workPage, tools) so that you don’t face null pointer exceptions.
Option 2 : Using Declare Expression
You can create a declare expression on the property .ParentTicketType and get the parent work case context’s TicketType value using the below function,
@pxGetValueFromParentPageOfProperty(StepPage, “TicketType”)
Then use the .ParentTicketType property as the parameter to your Events data page. This should fetch the events for that ticket type.
Pitfall in this approach is that every time you create an entry in the embedded data table or any where in the application, your declare expression will execute. But atleast there will not be any hardcoding.
You may want to guard your declare expression with certain conditions on the existence of parent context (pyWorkPage) before you access the function and ensure the execution won’t break.
Both the approaches will give you expected result. Choose the best one which suits your requirement after discussing with your LSA.
We went with Option 1 as we had just one screen where we utilized this embedded pagelist functionality. I know it’s not a good thing to hardcode but it is what it is until what we did.
Any other approaches/ideas to this solution from community members is highly appreciated.
Hope this helps. Happy Coding!!!
Thanks
JC