FOUR-32638: Fix Collection record list fields and values - #1927
FOUR-32638: Fix Collection record list fields and values#1927eiresendez wants to merge 2 commits into
Conversation
screen-builder
|
||||||||||||||||||||||||||||||||||
| Project |
screen-builder
|
| Branch Review |
task/FOUR-32638-FOUR-32640
|
| Run status |
|
| Run duration | 20m 57s |
| Commit |
|
| Committer | Eleazar Resendez |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
1
|
|
|
0
|
|
|
19
|
|
|
0
|
|
|
391
|
| View all changes introduced in this branch ↗︎ | |
Tests for review

tests/e2e/specs/FileDownload.spec.js • 1 failed test • CI - Chrome
| Test | Artifacts | |
|---|---|---|
| File Download > Can download a single file |
Test Replay
Screenshots
|
|
|
QA server K8S was successfully deployed https://ci-7971945b20.engk8s.processmaker.net |
|
@nolanpro @sanjacornelius could you please help assign a reviewer to this PR? The remaining CI failures are unrelated—a flaky FileDownload test and a Cypress parallel-run Chrome 150/151 environment mismatch. |
CarliPinell
left a comment
There was a problem hiding this comment.
One Important observation about Collection record id mapping in Preview.
| const optionsList = columnsSelected.optionsList; | ||
| const mappedColumns = collectionFieldsColumns.map((column) => ({ | ||
| ...column, | ||
| data: mapCollectionRecordData(column.data, optionsList) |
There was a problem hiding this comment.
mapCollectionRecordData only reads keys from column.data, but Collection API records expose the system id on the parent object ({ id, data: { ...fields } }), not inside data. After this PR always offers id as a column, Preview/table cells for that column stay empty for real Collection payloads.
The Cypress fixture masks this by putting id inside data ({ id: recordData.id, data: recordData } where recordData also contains id).
Impact: Users can select the id column (or All columns including id), but Preview and runtime Record Lists will show blank id values against real /collections/{id}/records responses.
Suggested Fix: Before mapping, merge the record-level id into the payload, e.g. mapCollectionRecordData({ ...(column.data || {}), ...(column.id != null ? { id: column.id } : {}) }, optionsList). Also update the Cypress intercept so data does not include id, and assert Preview still renders the parent record id.
There was a problem hiding this comment.
@CarliPinell Thanks for flagging this.
I verified the current Collection API contract: CollectionsApiCollection explicitly copies the parent record ID into data.id before returning records (source). I also confirmed that a real /api/1.0/collections/2/records response contains matching IDs at both record.id and record.data.id, so the Cypress fixture mirrors the production payload and Preview can map id from column.data. Could you share the endpoint or payload where id exists only on the parent? If that shape exists, I can add compatibility coverage; otherwise, no code change should be needed here.


Issue & Reproduction Steps
Collection-backed Record Lists regressed after the Collection schema was introduced as the source for available fields.
To reproduce:
idfield is missing.All columnsand inspect the generated configuration.contentandkeyuse thedata.prefix.The exported fixtures remain attached to Jira and are not included in this repository.
Solution
data.prefix, deduplicates fields, always includesid, and falls back to the first record when no schema is available.contentandkeyvalues for individual fields andAll columns.data.*configurations while rendering so existing Screens display their values without rewriting their saved configuration.id, flat keys, empty Collections, fallback behavior, Preview values, and legacy configurations.How to Test
Run:
npx jest tests/unit/CollectionFieldUtils.spec.js --runInBand --no-coveragenpm run run-cypress -- --spec tests/e2e/specs/CollectionRecordListColumns.spec.js --browser electronnpm run buildManual validation:
idand the complete Collection schema are available withoutdata.prefixes.All columnsand confirm the generatedcontentandkeyvalues are flat.data.*and confirm it renders correctly without automatically rewriting the saved configuration.Related Tickets & Packages
ci:deploy