Yes ,finally i figured out a way; often the problem lies in the default savable data pages generated while creating the data types. It has a data sourcing logic based on primary keys defined. As we are trying to write a new record ,this default data page may not work and throw some errors. Instead I did the following,
--Create another savable data page which is sourced from a data transform (no parameters should be defined)
--Inside the data transform ,move blanks/default values to all the fields in data type.
--In your flow/activity/flow action ,refer the data page and set appropriate values in all fields. (when you refer the data page ,it will be loaded based on the DT(i.e blank values)) ; override these values. For e.g via a data transform you can set appropriate values to fields inside this data page
--Save the data page (in flow using smart shape, in activity using Save-data page)
--If you observe tracer ,an error will be throw from Obj-Open by handle ,but as there is no record it will be gracefully handled and new record will be written to DB.
This worked for me. First of all update your savable data page SOURCE to data transform. In the data transform configure the the Parameters tab to set all the fields for the new record. Configure the same parameters on the Data Page also and select "Pass Current Parameter Page".
Now call the savable data page from your flow action and pass the parameters. That's it, pega will take care of the rest. Now need of writing a activity with Page-New, Obj-Save etc all those methods.
Enjoy the ease that Pega provides.
Posted: 2 months ago
Updated: 2 months ago
Posted: 8 Feb 2021 6:49 EST Updated: 9 Feb 2021 0:10 EST