Tuesday, February 27, 2018

AutoMob : Code Logic

For Auto Mobile Sales Application ParentPost, we need to build the logic for the below :
  1. Create (Generate) Customer ID by storing all the details given by the user on screen.
  2. Get the existing customer details when Customer ID is passed to system.
#1 Create Customer ID: 
Once user enters all the details in the screen 2 : and clicks on submit. 
Then PostShowCustomerDetails (post activity of flow action : PostShowCustomerDetails) would be invoked, where we code our logic to save the Customer details. 

#1.1 Page-New => Creates a new Page of type "Tata-FW-AuMobFW-Data-Customer"
#1.2 Page-Copy => From .CustomerInfo to CustomerPage
#1.3 Property-Set => Set the Customer ID; we kept the logic simple; we are getting the length of CustomerList, and generating the next number. 
Example :  5 customers exist, now a new customer comes, we generate customer ID as 6. 
#1.4 Obj-Save => Save the Page CustomerPage, with writenow checked.
#1.5 Page-Remove => Remove the temporary page as a best practice once its usage is over. 

Note: Please don't use Commit method after Obj-Save. We went with write now checkbox, because we have requirement to create customer ID as soon as user clicks on next post the details entered on screen 2 (ShowCustomerDetails) screen.

#2 Get the existing customer details when .CustomerInfo.CustomerID is passed. 
When user enters Customer ID, and clicks next, then our PostSelectCustomerType Data transform would be called, where we are copying all the details from Customer Data Page to Primary Page (.CustomerInfo).

Question: What is the data page : D_Customer[CustomerID:Param.CustID]
Answer: Pega has created this for us while building data type. No need to write any separate code for this. We can just use the same. 

This would bring all the details on to the screen, since we referred all our screen 2 properties. 

We have covered GET and SAVE operations in this post. 
Continue with the ParentPost

No comments:

Post a Comment

HowToPega : All rights reserved and the contents are copyrighted to Pavan Kumar Naidu