Data Level Attachments

In Pega, you can attach files and other documents to a case at various levels of the data model, not just at the top-level case. This allows for more granular control and organization of attachments within a case structure. You can add attachment fields to any level of the data model, including nested data objects or data pages, enabling you to associate files with specific data elements. You can define your field as a single attachment or a list of attachments. A screen with data level attachments is shown below.

Key Concepts:

  • Data Model: Pega’s data model allows for hierarchical structures, meaning you can have nested data objects within a case.

  • Attachment Fields: These are fields you define within a data class or data page that allow users to upload and attach files.

  • Attachment Categories: These categorize attachments, helping with organization and access control.

  • Access Control: Pega allows you to configure access control at the attachment level, specifying which users or groups can access specific attachments.

Benefits of Data Level Attachments:

  • Improved Organization: Attachments are associated with specific data elements, making it easier to find and manage related documents.

  • Granular Access Control: Control who can access specific attachments based on their role or data context.

  • Contextual Attachments: Attachments are directly related to the data they describe, providing a more intuitive user experience.

  • Document Storage: Approach continuhttps://docs.pega.com/bundle/platform/page/platform/case-management/sourcing-attachments-external-storage.html es to work with existing configuration for document storage (Pega or External).

  • See Document storage

Notes:

  • Pega Platform already allows attachments at the top case level, and now you can also add them at the lower levels of the Case Data Model.
  • Attachment fields can be used in an embedded page only if embedded in a case at any level. Attachment fields can’t be used inside the hierarchy of a standalone data record.

Business Scenario: Mortgage Application

ABC bank supports up to 4 people in a mortgage application. The bank wants to capture details of each applicant along with their proof of Identification (Passport or Driving License), Address (Utility Statement, Council Tax statement or Bank Statement) and Income Proofs (Pay-slips or Bank Statements for the last 2 months)

Solution Approaches:

The traditional way to capture documents is to attach them to the Mortgage case with relevant categories. Since all documents are attached to the case, documents related to each applicant are usually prefixed or suffixed with applicant’s name or initials to distinguish between them.

With this new capability, attach documents at any level within the case data model, we can handle attachments more efficiently. See Adding attachment fields

How it works at a high level:

  1. Define Attachment Fields: You can add attachment fields to any class, including data classes, to allow users to upload attachments.

  2. Choose Attachment Type: You can select whether to allow a single attachment or a list of attachments for that field.

  3. Associate with Data: The attachments are linked to the specific data instance where the attachment field is defined. For example, if you have a data class for “Employee” with an attachment field for “Resume”, the resume will be associated with a specific employee record.

  4. Configure Access: You can configure access control at the attachment category level or even at the individual attachment level.

  5. View and Manage: Users can view, download, or delete attachments through the Pega UI, and administrators can manage the attachments based on access control configurations.

Solution Approach 1: Attach documents to Applicant Data Object

Instead of attaching all documents to the Mortgage case, we can attach applicant specific documents to the respective applicant data object record. This will help us to easily locate the documents associated with each applicant. Moreover, we can differentiate the types of documents using the attachment field type. In this example, we are going to create 3 attachment fields (ID, Address, and Income). This will allow us to configure different business rules for each of them.

1. Create a Data Object called Applicant with the following details (Refer Screenshot below)

Name (Text)

Type (Primary, Secondary)

Date of Birth (Date only)

Proof of ID (Attachment)

Proof of Address (Attachment)

Proof of Income (Attachments)

2. Create an embedded field called Applicants of type Applicant in the Mortgage case

3. Create a Form view to capture the applicant details and documents

4 .Restrict file types for each of the attachment fields to better data quality

5. Add conditions to ensure that a minimum of 1 and maximum of 4 applicants are added

6 At runtime, documents for all applicants can be attached in a single place along with other details. If multiple attachments are allowed for a field, then the count of attached files will be shown (e.g. Proof of Income below). Clicking on the count link will allow the user to view the individual documents

Note: The attachment count in the utility widget is ‘0’ as these documents are not attached to the case directly. Only case level attachments count will be shown here

7. Can preview, delete and download attachments during Document upload

8. Can preview, delete and download attachments as per the security settings in another step. (In the screenshot below delete option is not allowed)

9. You can preview the document by clicking on the document. Please note that only certain file types are supported (e.g. jpg, jpeg, pdf, mp4, m4v, etc.). Unsupported file types can be downloaded and can be opened using the respective viewers (e.g. .doc using MS word)

Solution Approach 2: Use a Document data object

In this approach we are creating a dedicated data object to store documents and all its key attributes. This will help us to manage the documents more efficiently by using the associated attributes. For instance, we can track the expiry date of documents and initiate business processes/workflows based on that. Similarly, we can create an approval workflow for all documents. Another benefit of this approach is that we can see all the documents related to the Mortgage application case in a single place

1. Create a Data Object called Document with the following document specific attributes

Number (Text)

Type (Passport, Driving License, Utility, Council Tax, Bank Statement, Pay-slip)

Category (Identification, Address, Income)

Valid From (Date only)

Expiry Date (Date only)

Document File (Attachment)

Approved by

2. Create a Data Object called Applicants with the following details

Applicant Name (Text)

Type (Primary, Secondary)

Date of Birth (Date only)

Address (Text)

Documents (Document)

3. Create a view to capture applicant details along with the documents

  • Create an embedded field called Mortgage applicants of type Applicants data object.

4. Configure the Mortgage Applicants field as shown below

5. Run time view is shown below

Summary:

We have seen 2 ways of handling the documents more efficiently by making use of the new ability to attach documents at any level of the case data model. By associating attributes (e.g. expiry date) to the attachments, we can easily build business processes around the attachments like any other field. So, make use of this new capability while designing solutions involving attachments to serve customers better.

Constellation 101 Series:

Enjoyed this article? See more similar articles in Constellation 101 series.

@manup great run through. This new capability is not that well known so good to see it getting some airtime and a detailed walk through! thanks :slight_smile:

@manup Yes its a great concept and capability.

Thanks

HI @manup I do see the option to add Attachment field when in the data type screen however if you are in the case type there in the data model we can create a property to have attachment reference. Please share if this need some specific setting to be done as tested in 24.2 and also in 25.1.

Cannot able to do the following

1. Create a Data Object called Applicant with the following details

Proof of ID (Attachment)

Proof of Address (Attachment)

Proof of Income (Attachments)

@manup

I do not see attachment type from data type add field option. Pega Version 24.1 please see below the screenshot attached.

Is there a setting in pega to enable this?

@manup ,

Will this feature work from Mobile channel in any version 24.2 or 25.x ? I see some issues in the underlying page Instruction formation and issue while submitting attachments from embed data layer and it works fine from web channel by the way .

Could you please confirm that this feature works in Mobile version or not .

@Unnikrishnan T N I saw you asked on this post too. You should get a response tomorrow from someone in our mobile product and engineer team

@manup How can we hide/disable the delete option for the attachment? Is this possible?

The user cannot delete the uploaded file base on the user who uploaded. Only the user that upload can delete it.

@SrikiranV17310012, Data level attachments are available from version 24.2 only.

@manup - It is a valuable feature, and I am currently working to integrate it into our application. I would like to inquire whether audit logs are captured for data-level attachments in the same manner as when using the attachment widget. If audit logging is not handled similarly, could you please advise on alternative approaches to ensure audit tracking for data-level attachments?

@manup I am going to do the same, I create a case type called create project and a data record call project that contain attachment field. I can add the attachment to the project data embedded in create project case but I cannot save the project data back to database because of the attachment. I tried using savable datapage to save it, also tried to save it by activity.

How do you save the attachment fields?

How do you set the data type to be able to see the attachment? There is no wiget available to add in data type.

Thank you

@manup it appears to work only with Pega 25. Adding attachment fields to data types and embedding them as embedded objects within a case type didn’t persist when saving the case (one assignment to another) until Pega 24.2. If this isn’t expected could you please suggest the hotfix that resolved this?

@Gaurav25, I didn’t get the problem fully, let me try to clarify few things.

  1. Data level attachments are available from version 24.2 only
  2. If you are trying to use a Data object with attachments, first create the Data object with the attachment field types. Then create an embedded field using Data object created.

Detailed steps described in the article above