Data Pages: When to use Auto-populate over a direct reference to a Data Page [LSA Data Excellence]
Why would I use an Auto-populate (Refer-to or Copy-From Data Page) Property when I can also reference the Data Page I need directly?
Where the Data Page is parameterized and its parameter values are sourced from other properties held on the case, a Auto-populate property encapsulates that relationship between the Data Page and its dependent data -- once -- at design time. Other scenarios which reference that auto-populated data (embedded UI sections, Data Transforms, and now "Save data page" instructions) need only reference the property name, and not concern themselves with sourcing the correct keys to look up the correct record.
For example, if a Customer's Shipping Address was sourced from a D_CustomerAddress Data Page that took parameters:
- Customer ID ... a property available on the Customer class; and
- Address Type ... perhaps a literal value "SHIPPING"
... implementing an Auto-populate property "ShippingAddress" on the Customer class to link its Customer ID and the literal to the D_CustomerAddress Data Page records this relationship in one place (the Auto-populate property configuration). All other scenarios -- once they are working with an instance of Customer -- can make a highly-understandable reference to .ShippingAddress to instruct Pega to source the relevant data.
Should the means by which the Shipping Address is looked up change (perhaps the keys to the Data Page change; or a different Data Page needs to supersede it), the remainder of the application is abstracted from this detail. The application need is to obtain the Customer's Shipping Address as a component of Customer information; the application is abstracted from "how" and/or "where" that data is retrieved and stored.
Discussion on this topic was sought from the LSA Data Excellence (Pega 8.4) webinar conducted in July 2020. The webinar and its full set of discussions that arose from it are available at LSA Data Excellence: Webinar, Questions & Answers.