Pre-selecting items in multi-select list in Constellation
Enjoyed this article? See more similar articles in Constellation 101 series.
Why
In many applications, tables are used to display data in an organized manner, allowing users to interact with and manipulate the information presented. Preselecting rows in a table using a data transform can enhance user experience by streamlining workflows and minimizing manual input. This support article will guide you through the process of preselecting rows in Embedded and Data Reference tables, utilizing data transforms to automatically highlight specific records based on predefined criteria.
Business use cases
- Improving Data Consistency: By programmatically selecting rows based on specific rules, you can ensure that users are consistently viewing and interacting with the same set of data, reducing the risk of errors.
- Enhancing User Experience: By preselecting rows that match certain criteria, users can quickly identify important records, improving the overall efficiency and effectiveness of their interaction with the application.
- Facilitating Batch Operations: In scenarios where users need to perform batch operations, such as approving or rejecting multiple entries at once, preselecting relevant rows can significantly reduce the number of clicks and streamline the process.
Prerequisites
Before implementing preselection of rows, ensure that your data model is set up.
In this example we will be using a File data object with the following fields:
- IsSelected - indicates row selection, you could alternatively reuse pySelected from baseclass
- Name – filename without extension
- Type – file extension
- URL – dummy link to the file
Pega is system of record, therefore pyGUID will be the primary key.
It's important to have a clear understanding of your data structure as it forms the basis for the data transform logic.

Implementation
Now I will do my best to explain the topic by splitting it into 3 areas:
1. Data Model and Case Type
2. UX configuration
3. Preselect and data population Data Transforms
Data Model and Case Type
To showcase preselection, the workflow includes two fields based on File data class. This configuration helps to clarify the differences between managing data that is embedded directly in the case and data references that access other sources.

Let's begin with the Embedded Files field. Since this is a property requiring manual data access, it must first be populated with data saved within the case itself. Note that embedded fields do not provide an out-of-the-box multi-select input mode. Therefore, the IsSelected Boolean property defined in the File data class will be used instead.

The situation differs for the Data Reference list. This list does not require options stored within the case, as it sources from a list structure Data Page. The Data Reference Files field actually stores a list of references (pyGUIDs) to the D_Files Data Page. Hence, the whole table displayed in the user interface is not stored within the Data Reference Files—only selected items are stored. The IsSelected or pySelected properties are not applicable here; instead, the Data Reference Files list will be populated with pyGUIDs that should be pre-selected.

The case type is designed to be very clear, showing that data transforms responsible for preselection are executed before the Collect Information steps. These data transforms can also be applied through the Configure View > Pre/Post Processing tab on Collect Information steps or via the Flow Action configuration in Dev Studio.

UX configuration
Because the IsSelected column is used to mark selected items, the entire Embedded Files field is set up as an editable table. The other columns are read-only to prevent any alterations to the data (unless your specific solution requires it).
In this demonstration, labels and captions are hidden to make the table's appearance align more closely with the default multi-select control, basically to improve the look on screenshots. However, remember that prioritizing accessibility over aesthetics is considered a best practice.

The configuration of the Data Reference view is relatively simple, as it leverages Constellation's multi-select mode. The table is populated from the List Files (D_FilesList) data page, which uses dummy records added during the creation of the File data object.

Preselect and data population Data Transforms
- Embedded data use case
As previously emphasized, embedded data must be within the case to be operated on. For this case study, preselection will rely on the file Type.
See the Data Transform logic below:

Step 2. Iterates over D_FilesList, which is the list of our dummy records
Step 2.1 When condition determines the file type
Step 2.1.1 When above condition is met (file type is “txt”), IsSelected flag is set to true
Step 2.2 Otherwise, IsSelected flag is set to false
Step 2.3 Appends the current record and thus builds the .EmbeddedFiles list, which includes IsSelected field.
The list's further processing and any bulk actions should involve the .IsSelected Boolean property to determine if an item is selected.
- Reference data use case
Regarding reference data preselection, there is no need to initially populate the list separately, nor do we use the supporting IsSelected property.
Let's consider two scenarios (S1 and S2), each working independently to preselect certain items.

Scenario 1 (S1) – we will reuse embedded files list, as it is already populated:
What is important, appended page having its pyGUID
Step 3. Iterates over .EmbeddedFiles list
Step 3.1. When condition determines the file type (file type is “pdf”)
Step 3.1.1. When above condition is met, the whole page is appended to DataReferenceFiles.
Scenario 2 (S1) – to highlight that in data reference fields we require only the key properties
Step 4. Iterates over D_FilesList page list
Step 4.1. When condition determines the file type (file type is “txt”)
Step 4.1.1. When above condition is met, the TempPage is initialized with only the pyGUID property.
Step 4.2 TempPage having only the pyGUID is appended to the DataReferenceFiles list
Conclusions
Equipped with this knowledge, you can effectively implement preselection through data transforms or activities. This approach can be further extended, enabling you to address sophisticated business scenarios, whether involving embedded or referenced data, and to optimize user experience or automate workflows.