Use case: Send file attachments from a repository
You are running an insurance claim case for a car insurance company. You must send a payment request to the insurance carrier of the driver who hit the car that belongs to your client.
The payment request for this case is stored as a PDF file in the PaymentRequests repository on your company system.The following sections describe the components of the configuration that your application needs to retrieve the PDF file from the PaymentRequests repository and send the payment request to an external system.
UploadPaymentRequest activityThe UploadPaymentRequest activity explains how to retrieve the PDF file and send it by using a REST connector. You use this activity to construct the pyRequestAttachmentPage and call the REST connector.
For more information, see Creating an activity.
The following image shows a sample of the UploadPaymentRequest activity configuration:
pyRequestAttachmentPageThe pyRequestAttachmentPage page is a clipboard page where the REST connector formats the outgoing message payload. In this case, the payload is the contents of the payment request PDF file. You create the pyRequestAttachmentPage by configuring a Page-New method in the UploadPaymentRequests activity.
For more information, see Activity form - Completing the Steps tab - Entering Method parameters and the Page-New method.
You also must add the pyRequestAttachmentPage and its class to the Pages & Classes tab of the UploadPaymentRequest activity, so that the activity knows which page to create at run time.
For more information, see File attachment configuration in REST and SOAP integrations and Defining the pages and classes of a rule.
GetFileFromRepository activityTo specify the file you are retrieving and the repository where the file is located, you call the GetFileFromRepository activity from the UploadPaymentRequest activity. To retrieve multiple files from a repository, you can call the GetFileFromRepository activity from multiple steps.
For more information, see Call-Function.
Properties on the pyRequestAttachmentPageThe properties on the pyRequestAttachmentPage map to the MIME headers in the partitions of the outgoing REST message payload. The payload for the payment request resembles the following example:
Content-Disposition: form-data; name="InsurancePaymentRequest.pdf"; filename=" InsurancePaymentRequest.pdf" Content-Type: application/pdf Content-Transfer-Encoding: binary
The following table shows the properties that you configure on the pyRequestAttachmentPage and which headers they map to.
You configure the values for these properties in the GetFileFromRepository activity. Use the Property-Set method and enter the property names and values as method parameters.
For more information, see Property-Set method.
D_pxGetFile data pageThe Pega-provided D_pxGetFile data page retrieves the file content from the PaymentRequests repository. The pyContents property value from the data page is appended to the pyAttachValues value list property on the pyRequestAttachmentPage. The pyAttachValues value list property is configured in the GetFileFromRepository activity as follows:
For more information, see Get file API.
REST connectorThe REST connector finds the pyRequestAttachmentPage and formats the outgoing message payload. You call the REST connector from the UploadPaymentRequest activity by using the Connect-REST method.
After it invokes the REST connector rule, the UploadPaymentRequest activity uses the Page-Remove method to remove the pyRequestAttachmentPage from the clipboard.
|Next: Learn how to process the PDF file that the insurance carrier returns. For more information, see Use case: Process inbound file attachments for storage in a repository.|