E-Form Processing in Pega
What is E-Form
The EForm feature supports applications that work with PDF files and help to parse the Data. The Pega Platform can also merge data from the clipboard into a PDF form, generating a new PDF document.
EForm file rules hold uploaded PDF form files that are used as templates when generating new PDF documents.
Their corresponding eForm map rule is Rule-Map-eForm.
PDF Data parses to Clipboard using E-form
Here is the requirement that we need to work on, I have a PDF with some data viz., Name, Age, Blood Group, etc., I need to upload the PDF file to Pega and the PDF data needs to be parsed and mapped to clipboard and this should be displayed in the section. Let's check how to do this.
1. Open Designer Studio. In Integration, expand tools and select PDF for EForm Wizard.
2. Write the Description for the EFrom
3. On next screen write the appropriate class name in "Applies to" box and select the ruleset and version to create the E-form rule and click Next.
4. Once the configuration of eForm properties is done, upload the pdf template that you need to parse for the case.
5. The e-form PDF properties are displayed in follow up screen, select the field that you need to map to clipboard and click Next
6. The E-form Map rule is configured in this screen with the selected fields from the last screen. Map the field where you need to display the data in Pega.
Note: If the existing case properties are not shown, define it as .pyNote. This enables us to modify this rule later as required.
7. The final screen shows you the E-form rule and E-form map rule configuration, we can define new name to the E-form and map the required rules here.
8. When we reach the Finish step, the PDF E-form Instance is resolved with the creation of some rules in the defined applies to class.
9. Go to App explorer in the Designer studio and select the class where you created the E-form rule. You will be able to see the mapped rules that got created under Integration-Mapping.
10. Open the Map eForm rule to Map the properties to the clipboard. Define the pyWorkPage in Pages and classes and use it to map the properties.
11. As per requirement, we need to show the data in UI, For that, we have created a case type with the stages NEW and Resolve alone with steps: 1. Upload and 2. View Details.
12. In upload, Included a Button to attach the PDF in the AttachementPage. The section configuration is as below.
13. For extracting the pdf data from the PDF and displaying it in the section we can include the Activity on the post action of the flow action in this flow.
14. Open the Flow action, under post-processing, include the activity "MapEfromDataNew" and click the cross-hair icon to create the activity.
15. Configure the activity as shown below.
Note: In step 6 we can use Commit or Obj-Save (optional, based on the performance).
16. In step 4 - Java, we are using a local variable and a common parameter to Pass the data from the flow.
17. The step pages' classes are defined in the Pages and classes tab.
Step 1 & 2: In this step, We have set the properties that are required to be fetched from the clipboard for the execution of the activity.
Step 3: We have created a page to run the java step.
Step 4: We have decoded the stream data generated while uploading the document in Pega.
Step 5: We are calling the OOTB Activity to Extract Data from PDF "ExtractDataFromEForm"
The stream data in the clipboard are in the property "pyAttachStram"
All the configurations are done. Let's test it by running the case. We have attached the test output video for reference.
It works like a charm!!
The Pdf File we have used here is attached below.