Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Use case: Process inbound file attachments for storage in a repository

Updated on April 6, 2022

You are running an insurance claim case for a car insurance company. You send a payment request of $1,500 in a PDF file to the insurance carrier of the driver who hit the car that belongs to your client. The insurance carrier adds a revised payment amount and returns the PDF file renamed: InsurancePaymentRequest-Disputed.pdf.

Your company stores payment disputes in a PaymentRecords repository in a folder named Disputes.

The following sections describes the components of the configuration that your application needs to process the incoming PDF file and store it in the PaymentRecords repository.

REST service

The REST service passes parameter values to the service activity. In this case, the REST service passes the repository name (PaymentRecords) and the folder name (Disputes) to the ProcessPaymentDisputes service activity.
REST service configuration
Sample of REST service configuration for passing parameter values

Note: When you configure the REST service, on the Methods tab of the rule form, make sure that the request message body Map to and Map to key fields are blank.

For more information, see Service REST rules.

ProcessPaymentDisputes service activity

The ProcessPaymentDisputes service activity explains how to process the InsurancePaymentRequest-Disputed.pdf file and write it to the PaymentRecords repository. In the first step of this service activity, use the @PageExists("pyRequestAttachmentPage") utility function in a step precondition to check that the pyRequestAttachmentPage appears on the clipboard.

ProcessPaymentDisputes activity configuration
Sample of the ProcessPaymentDisputes activity configuration

After you confirm that the pyRequestAttachmentPage exists, you call the WriteToRepository activity from the ProcessPaymentDisputes activity.

Note: You also must add the pyRequestAttachmentPage and its class to the Pages & Classes tab of the ProcessPaymentDisputes activity, to ensure that the activity knows which page to use at run time.

For more information, see Creating an activity.

WriteToRepository activity

When you call the WriteToRepository activity, it performs the following actions:

  • Iterates over the values in the .pyAttachValues value list property on the pyRequestAttachmentPage.

    For more information, see Repeating steps in an activity.

  • Composes the file path parameter value by retrieving the name of the attachment, InsurancePaymentRequest-Disputed.pdf, and applying it to the folder name (Disputes). The folder name is passed into the activity as a parameter. See the following syntax as an example:
    • PropertiesName: param.filePath
    • PropertiesValue: param.folderName+”/” + .pyAttachNames(<CURRENT>)
  • Copies the contents of the InsurancePaymentRequest-Disputed.pdf file to theD_pxNewFile data page by using the following syntax:
    • PropertiesName: D_pxNewFile.pyContents
    • PropertiesValue: .pyAttachValues(<CURRENT>)
    Note: Be sure to put param.filePath on the parameter page before configuring the step to copy the contents onto the D_pxNewFile data page. Otherwise, the system might display a null page.
For more information about calling an activity, see Call-Function. For more information about setting properties in an activity, see Property-Set method.

D_pxNewFile

The D_pxNewFile data page writes the file content from the InsurancePaymentRequest-Disputed.pdf file to the PaymentRecords repository by passing in the following parameters: repositoryName and filePath.

Use the Save-DataPage method to save the file to the repository.

Save-DataPage method configuration
Sample of configuration for saving a file to a repository

For more information, see Get file API.

Previous: This use case is a continuation of the outbound use case. For more information, see Use case: Send file attachments from a repository

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us