Before reading this post, we suggest you go through our previous posts on the Data Page that covers all the basics & core aspects of the data page.
What is Savable Data Page?
We might have used data pages to maintain a copy of data in temporary memory[Clipboard] for faster retrieval and ease of access. From PEGA version 7.4 onwards, data pages are enhanced with an option to persist data. This can be achieved by configuring Data Page as Savable.
For Example, let’s consider a requirement where a customer can have more than one address and we are supposed to loop through the list of addresses to set a property FullAddress and save the changes back to the database. Let’s now see its implementation with and without a savable data page.
Without Savable data page [Prior v7.3]
- Create a data page to fetch the list of addresses [Business Logic].
- Write an activity to loop through the list of addresses and implement logic to populate FullAddress [Business Logic].
- Save and commit the changes back to the database [Transactional Logic].
With Savable data page [From v7.4]
With Savable data pages, we can combine both the business logic and transactional logic of any given scenario inside the same data page.
- Create a data page to fetch the list of addresses. Using Data save option, loop through the results, have logic to populate FullAddress & save the changes to the database.
How to Configure a Savable Data Page?
- Starting from Pega v7.4, there is a new Mode of the data page Savable.
The Savable mode is available for both Page and List structure data page.
The Savable mode is available only for the Thread and Requestor scope data page.
- Data Save options section is enabled in the data page rule when the Mode is selected as Savable.
Save Type
- This option defines the method using which the data gets persisted in the database.
- We can select from the below methods,
- Database save – This triggers the direct obj-save on the data page. This method is applicable only for the data page with Page mode.
- Robotics automation – This method is used to trigger a robotic automation process to save changes to the database. This will be discussed in our later posts.
- Robotics desktop automation – This method is used to trigger a robotic desktop automation process to save changes to the database. This will be discussed in our later posts.
- Activity – This method is used to invoke an activity rule to save changes to the database. This method is preferred when the data page is of the List structure.
Database save as Save Type
This is pre-selected when the structure of the data page is Page. This method has three parameters to configure,
- Class Name – Class instance to which the changes are to be saved. In most cases, this will be the same as that of the data page class.
- Data transform – A data transform rule to run in case of any data manipulations. This field becomes mandatory when data save class is different from that of the data page class.
- Validate rule – We can invoke a validate rule to check the adherence of any of the fields in the data page. The system throws an error at run time if the validation fails.
Activity as Save Type
This is pre-selected when the structure of the data page is List. This method has only one parameter to configure [the activity rule to invoke].
Local Save
- This check-box is used to denote if the changes are to be saved to a local table or to an external system. In most of the cases, this will be selected as we deal with updating the internal tables in most of the scenarios.
Multiple Save Option
- We can have more than one data save option configured in a data page and can be conditionally executed.
How to Trigger a Savable Data Page?
Do Savable data pages get triggered automatically when a save/commit happens in the case?. Absolutely No 🤞.
We need to explicitly trigger the execution of the data save option whenever required. We can do that in the following ways,
- During case level processing, this can be triggered using smart shape [Save data page] in the flow rule.
- During assignment level processing, this can be triggered by defining it in the actions tab of the flow action rule.
- During stand-alone processing, this can be triggered using the Save-DataPage method in the activity rule.
Let’s implement a real-time scenario using the Savable data page to understand its execution better.
Business Scenario
OSP organization has a claims application to process the reimbursement request submitted by Customers. The system maintains the customer’s personal details and addresses details in local storage. Now requirement says that the customer should be given an option to update their personal and address details anytime in the system.
Implementation
- As mentioned, we have created two data types in Pega to maintain customer personal details and address details.
- Starting from v7.4, whenever you create a data type in Pega the system auto-generates three different data pages.
- Let’s quickly see the required data page configuration for our implementation. D_CustomerSavable data page for personal details and D_AddressSavable data page for address details.
- SaveAddressChanges activity used in the above step has the logic to loop through the addresses in the data page and save the information into the database.
- Since the requirement says that the customer should have the ability to update personal and address information at any given time, this can be added as a case wide action in the claims case type.
- In our implementation, we use flow action to update the customer information and hence the logic to trigger the savable data pages are configured as part of the actions tab in the flow action rule.
Execution
- Now, customers can update their personal and address information as part of the new action provided.
- When the customer updates the information and clicks on submit, the savable data pages configured as part of flow action executes at the back-end and updates all the information to the database.
What happens at the back-end?
- When the savable data pages are configured in the Actions tab of the flow action rule, Work-.RunFlowActionactivity executes the data save option of the configured data pages before running the post-processing logic [Data transforms, Activity] in the flow action.
- When the savable data pages are configured as a smart shape in the flow rule, Work-.pzSaveDataPage executes the data save option of the configured data page.
- When the data page is configured to run as part of the Save-DataPage method in the activity rule, @baseclass.pxUpdateRecord executes the data save option of the configured data page.
Advantages of using Savable Data Pages
We all might have this question on why to use Savable data pages when you can easily achieve the same using an activity rule. Even though we can do an obj-open in an activity, we prefer the data page with look-up. In the same way, savable data pages are recommended over an activity rule with an obj-save.
The below considerations make Savable data page unique and more preferable.
- Pages that we create in an activity rule are only specific to thread. With Savable data pages, we can reuse the updated information across the threads.
- Savable data pages ensure maximum reusability as it wraps both business and transactional logic together. If in case the transaction logic is implemented using a separate activity, we need to call that activity every-time when we update the data page.
- Savable data pages are easy to configure and maintain.
- Future enhancements/changes are very minimal when it comes to savable data pages since this follows the single source of reference.
Pointers to Remember
- Savable data pages can be used as a replacement to open/browse records and saving the information back to the database using activity.
- The savable mode is applicable only for thread and requestor level data pages.
- The savable mode is applicable for both page and list structure data page.
- Refresh strategy in a data page is not applicable when the mode is of Savable.
- Data save option in a savable data page should be explicitly triggered using any one of the possible options (Flow level, Flow Action Level, Activity level).
- When the data page instance does not exist in the clipboard when Save data page gets executed, it freshly loads the data page and performs the save.
- Savable data page saves the information even when there is no change in the data. So careful consideration is required when saving the data using the savable data pages.
We are now at the end of the post on Savable data pages. Hope from now on we will start using Savable data pages in our daily implementation.
Stay tuned for lot more posts on Data Modeling 😊
Hi Team,
You are doing great work. I have become a big fan of your site. Could you try and do the below topics?
Section > Data Display (8.3 version, previous versions also available) > Map
Calendar Events
Chat Bot
Mash Up
Through Alexa (speaking in alexa) based on that creating Case in Pega (if possible)
JMS
Thank you so much @Balakrishnan
Sure we will publish articles on the requested topics. Going forward please make sure you use the below link to suggest topics as we have a separate process to keep track of items that come through that.
https://onestoppega.com/request-new-article/
Happy learning from OSP 😊
Guys, this is awesome. Very well explained and kudos to take a new topic like this guys. Was waiting for an article like this guys. Hats off guys.
Thank you so much @Aditya Kunal
Happy Learning from OSP 😊
Nicely explained. Loved this article.
Thank you so much @Chaitanya pinnireddy
Happy Learning from OSP 😊
Good one man. My favorite article next to broadcast. Waiting for more good ones like this.
Thank you so much @Shashankey pinnireddy
Happy Learning from OSP 😊
Nice article.
Thank you so much @Dharanikumar dhandapani
Happy Learning from OSP 😊
Nice explained. Everytime when I go through your post I will get two things one is knowledge another one satisfaction of learning. Great effort and thank you.
It really feels happy to hear this kind of feedback from our readers. Thank you so much.
Happy Learning from OSP 😊
Indeed a good post. Thank you guys!
Thank you so much @Chandan
Happy Learning from OSP😊
I’m not sure if the following is accurate “When the data page instance does not exist in the clipboard when Save data page gets executed, it freshly loads the data page and performs the save”
I’m getting an error “Unable to load data page D_XYZSavable. Required parameters : XYZName. cannot be blank
Since there is no data and I’m trying to do an insert, the lookup may be trying to find an instance and throwing this error.
My COnfiguration –
Structure: Page
Mode: Savable
Lookup and a Class
Database Save
The issue that you are facing is not related to the Savable data page and it’s common for any mode of the data page.
If you have a parameter marked as required in the data page and if you try to invoke the same data page with a null value for the parameter, it will throw you an error.
Please make sure you pass the parameter and invoke the data page and you will see the fresh load of data page happening and the data save operation.
The above issue would have come even for load of data page if required param is not passed. Can you confirm if you have passed required param?
Nice bro. Thanks.
Happy Learning from OSP 😊
Great post- probably one quick add in points to remember- When savable data page is invoked from flow action then save happens before execution of post processing Data transform/ activity. Order if execution is Savable data page -> Post Data Transform -> Post Activity.
Other point to add is that error handling for savable data page doesnt happen via post processing activity configured in data page. Instead it can happen in post processing activity of flow action or the activity which calls Save-DataPage method.
That’s a great point. We will update our post with these pointers. Thanks much for putting in the effort to bring this to our knowledge.
Happy Learning form OSP 😊
Could you please clarify whether this feature can be used to insert a brand new record.
The savable data page is not restricted only for updating an existing record. It can also be used for inserting records too.
Could you please provide the steps for this.
Sure we will. Can you please raise this as a discussion in our Forum so that it would be useful for everyone.
Happy Learning from OSP 😊
What is the exact use of the Local Save option. Is it just to record if that Data Page is saving records in internal or external tables? Where will we use this Local Save option data configured on the Data Page?
Do you guys have idea about aggregated data page guys? Please do a poc article guys on this.
Any update to my request guys? I asked this. Then I keep asking property qualifier but no response for any of my request. Atleast tell na guys if possible or not. U guys never respond to me nowadays it is making me feel bad guys.
I saw ur upcoming post list guys. Thanks for prioritising my ask guys. All will get to know a new feature pega providing in 8.4, my lead also will check that post guys thanks so much.
@Aditya Kunal. If they are scolding you better you don’t go out of your way telling our friends to visit this blog. I also don’t find it ethical to scold. Fyi am referring to this request and also 1 comment in data page article where you shouted at my best friend Kunal bro. Please don’t shout without knowing other person intention. Kunal bro is very genuine who has a lot of passion for learning and sharing knowledge.
why did u call save , can we do obj save instead of that
Many a time we would be having situation to update database outside of case context. If we use obj save we have to take care of commit. Savable takes care of commit. Osp guys correct me if am wrong.
@ Aditya Kunal, We guess @Sarat’s question is more of using Save API instead of obj-save method.
Either way works. But Save API provided OOTB takes care of writing history, doing obj-save and does roll back in case of failure. Just to ensure we get the most of the OOTB’s feature we used Save and nothing else.
Happy Learning from OSP😊
This post really helped me to get a quick and detailed idea of Savable Data pages. Thanks much and keep up the good work 🙂
Thank you so much @Griffith
Happy Learning from OSP 😊
Nice Articles..
I have one Clarification.
Does Call Save activity have obj-Save and commit steps on it? Are Obj- save and commit steps mandatory to save the list using savable data page. please confirm.
Hi Team,
I have one doubt. For list type structure, we use “activity” as save type .
In Activity, we copy the result on custom page. and also we can’t use obj save to save the result .
So how result will save into DB.
Editable datapage will take care ?
It should be copied to a custom page and the custom page should be persisted to the database. You can refer to our post business scenario #2 to get a better understanding.
Hi Team,
Still I have one doubt. For List type , saving the data we use either Save API or Obj-save.
Then what is the use of savable data page by using activity . Without using savable datapage also we write same step(Custom Page ,Obj-save) in activity to save the data and call from Post activity.
So what is the benefit to write same activity step and call from savable datapage.
Please clarify on this.
Thanks
I am also having the same doubt
Great work team.
Thank you so much for the post, Am surprised once we migrated to 8.2 from 7.1.9 what is that savable data pages..
Thanks, Naveen. Happy Learning !!
Keep working, nice job! Exactly what I needed to get.
Good post. I be taught one thing more challenging on completely different blogs everyday. It would always be stimulating to learn content material from different writers and practice a bit one thing from their store. I’d choose to make use of some with the content material on my weblog whether or not you don’t mind. Natually I’ll provide you with a link on your web blog. Thanks for sharing.
Hello all, awesome article, very nice approach.
I have a doubt here, considering the Flow Action setup and the fact that it runs before the post-processing logic, am I able to consult the data page just saved in post-processing activity straight on the savable page or should I go through the list and possible the last item added?
I am a first time user in your site. Savable data page concept is explained quite nicely.I still have one question though.Can we use Savable Datapage if we need to save data for the first time? For example during registration process a CSR enters data in pega on behalf of a customer. Customers basic details and addresses need to be captured in pega. Can we make use of Savable data page in this scenario?
This excellent website definitely has all the information and facts I wanted concerning this subject
and didn’t know who to ask.
Can you please explain how to insert data into table using savable data page.
I tried what is given in the below link but am still facing issues while creating a record. Even though I pass the parameter at run time it takes it as null value.
https://collaborate.pega.com/question/inserting-record-using-savable-data-page
I created a Savable Data page with data transform as source with no params defined and have blank values for the keys.
I created another DT where I pass actual values to the fields in the table. From this DT am calling an activity to Save-Data Page by passing the keys but it throws me an error to insert record to the DB. Any help would be appreciated.
Thank you