This post is all about working out a tutorial on service file rules in rule.
I have explained the configurations about service file rule in my previous post
It a mandatory pre-requisite to go through my previous post before continuing this post
I have already explained the business requirements in my previous post.
- External system sends us the input file with a list of customer details.
- For each record in the file, you need to create a new Sales case with the details provided.
Below is the input file we get from the external system.
Let’s straight away start the tutorial
Step 1: Create a new service file rule. I have already created in my previous post. I am going to use it
Step 2: perform the below configurations as shown below
Since I am going to create the sales case from the details provided from the file, my primary page will be OMXG07-FirstApp-Work-Sales
Method tab – Same configuration as we saw in the previous post.
Processing method – by record type
Record terminator – \r\n
Offset – 0
Length – 2
Data mode – text only
Character encoding – Default
Request tab – Same configuration as we saw in the previous post.
For the record type 10 & 99, use Skip as Map to
Map to key – MapCustomerData.Customer is the namespace for the parse delimited we created before
Below is the configuration for parse delimited rule.
I need to specify the activity in Parse segments row. For this, I am going to create a new processing activity
Step 3: Create a new activity rule for processing the data
I am creating the activity in the primary page class
A simple activity with one step.
I am using the OOTB activity svcAddWorkObject, that accepts the pyStartCase, the starter flow for the sales case as parameter. This activity can create a new case
- There are many OOTB activities to create cases in pega. Mostly all the case creation activities use the two main reusable activities createWorkPage and addWork.
- The speciality of this activity is , It passes the current step page as MergePage parameter to Call createWorkPage activity.
It means the primary page in service file rule – MyServicePage will be the current step page and it will be passed in as mergepage parameter. Remember, after parsing MyServicePage will hold the values of customername, age and sex.
- Finally in the createWorkPage activity, the MergePage content will get merged with the pyWorkPage. This is how the data from the file is getting passed to the case.
Note: This is not the only way to pass the data to pyWorkpage
Save the activity rule.
Step 4: Specify the activity rule in the parse segments array.
Step 5: prepare the csv data
Step 6: Run the service file rule manually using actions button and supply the file.
Step 7: If you need, you can trace the service-file rule.
You should get success message
Last step: Verify it.
You can always verify the case details from the designer studio.
App explorer -> Click on the class to view the instances.
You can see 3 sales got created in the same minute!!
By the way, my current time is not 4.01 PM. It is +6 hours ahead.
One more verification: let’s see, if the customer details are rightly populated in the case.
Click and open the case S-38, last created case.
Customer name is Sandosh and age is 26. Cool.
Parse rules – map the data from external system to pega;
service-file rule – process the data.
Finally the missing piece file listener – listen the file and invoke processing via service file.
File listener will be covered in my next post! See ya
Once again, Rest in Peace GINGER!