Posted: 14 Mar 2019 22:49 EDT Last activity: 10 Apr 2019 11:10 EDT
Dynamic json payload parsing over pagelists
(platform version 7.1.9)
We are hosting a service that will receive a variable json payload as a text field (otherwise risk having to generate 100s of data model classes and parsing logic).
Per some other articles, I'm able to use @(Pega-RULES:Page).pxConvertStringToPage to effectively build the clipboard page from the received json (using a simple step page of type Data-). Since the json structure includes complex elements, the generated page has nested embedded pagelist properties and am having difficulty iterating over these lists given design time validation errors in DTs or activities. I'd like to avoid java if possible.. $ANY seems to not work on pagelist props anymore so am hoping others may know a trick.
In this example, attempting to iterate over the .phoneNumbers pagelist property generates the 'the page must be of type pagelist / pagegroup design time validation errors in data transforms and activities. The only thing that kind of works now for me is to write java that converts pagelist props to code-pega-lists after the fact, but it is messy and due to the nested structure, requires a recursive approach which is costly in maintainability and complexity.
Lots of smart people out here, ultimately I'd like to be able to iterate over all properties of this dynamically generated Data- class instance to map these values to our Pega BLL classes. Thanks in advance!
As I haven't heard anything back from anyone on this topic, I moved forward with an approach that converts all pagelists in the generated nested page structure into code-pega-list properties recursively. This was a bit of work, but it did allow us to then use these dynamic data models in downstream DTs and activities.
-- perhaps a product enhancement would be to have the OOTB function do this type of heavy loading, or re-open the use of $ANY for pagelist props
A feedback request has been created on your behalf in our internal portal. The feedback ID is tagged to the issue description above (under Related Support Case Number). Use this FDBK ID as reference to connect with your Pega Account Executive to track the progress of this request.