From ea5b7985ab271465e090c5f130411c336964258a Mon Sep 17 00:00:00 2001 From: Etienne-SFDO Date: Sat, 27 Jun 2026 16:01:22 +0100 Subject: [PATCH] Fix Person Account files not showing and component error in App Builder - FilesListController: add missing return statement so empty searchTerm correctly delegates to getAllRelatedList instead of falling through to the search query path - Replace WITH SECURITY_ENFORCED with WITH USER_MODE throughout for compatibility with API v55+ - fileCard: guard objectInfoData null checks to prevent component error when properties are changed in Lightning App Builder - Bump all metadata API versions from 48.0 to 63.0 Co-Authored-By: Claude Sonnet 4.6 (1M context) --- .../mobilePanelList.cmp-meta.xml | 2 +- .../ContentVersionFieldsPicklist.cls-meta.xml | 2 +- ...tentVersionFieldsPicklistTest.cls-meta.xml | 2 +- classes/FilesListController.cls | 22 ++++++++----------- classes/FilesListController.cls-meta.xml | 2 +- classes/FilesListControllerTest.cls-meta.xml | 2 +- .../downloadFilesModal.js-meta.xml | 2 +- .../emptyIllustration.js-meta.xml | 2 +- lwc/fileCard/fileCard.js | 4 ++-- lwc/fileCard/fileCard.js-meta.xml | 2 +- .../mobileDataTable.js-meta.xml | 2 +- lwc/mobilePanel/mobilePanel.js-meta.xml | 2 +- .../mobileSortButtonMenu.js-meta.xml | 2 +- lwc/noFilesView/noFilesView.js-meta.xml | 2 +- lwc/paginator/paginator.js-meta.xml | 2 +- lwc/photo/photo.js-meta.xml | 2 +- lwc/photoModal/photoModal.js-meta.xml | 2 +- lwc/pubsub/pubsub.js-meta.xml | 2 +- .../uploadFilesModal.js-meta.xml | 2 +- 19 files changed, 28 insertions(+), 32 deletions(-) diff --git a/aura/mobilePanelList/mobilePanelList.cmp-meta.xml b/aura/mobilePanelList/mobilePanelList.cmp-meta.xml index 4f7ebcc..04aefb0 100644 --- a/aura/mobilePanelList/mobilePanelList.cmp-meta.xml +++ b/aura/mobilePanelList/mobilePanelList.cmp-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 A Lightning Component Bundle diff --git a/classes/ContentVersionFieldsPicklist.cls-meta.xml b/classes/ContentVersionFieldsPicklist.cls-meta.xml index db9bf8c..5f399c3 100644 --- a/classes/ContentVersionFieldsPicklist.cls-meta.xml +++ b/classes/ContentVersionFieldsPicklist.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 Active diff --git a/classes/ContentVersionFieldsPicklistTest.cls-meta.xml b/classes/ContentVersionFieldsPicklistTest.cls-meta.xml index db9bf8c..5f399c3 100644 --- a/classes/ContentVersionFieldsPicklistTest.cls-meta.xml +++ b/classes/ContentVersionFieldsPicklistTest.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 Active diff --git a/classes/FilesListController.cls b/classes/FilesListController.cls index ffee9a0..4832085 100644 --- a/classes/FilesListController.cls +++ b/classes/FilesListController.cls @@ -1,25 +1,22 @@ public with sharing class FilesListController { - + @AuraEnabled(cacheable=true) public static List getRelatedFilesByRecordId(String recordId, String fieldsParameter, Integer queryLimit, String searchTerm){ searchTerm = searchTerm.trim(); if (searchTerm == '') { - //Get all the related files as expected - getAllRelatedList(recordId, fieldsParameter, queryLimit); + return getAllRelatedList(recordId, fieldsParameter, queryLimit); } searchTerm = '%'+ searchTerm +'%'; - //return query via searchTerm if(Schema.sObjectType.ContentDocumentLink.isAccessible()){ - List files = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId WITH SECURITY_ENFORCED ]; + List files = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId WITH USER_MODE ]; ListfileIDs = new List(); for (ContentDocumentLink fileLink : files){ fileIDs.add(fileLink.ContentDocumentId); } if(Schema.sObjectType.ContentVersion.isAccessible()){ - String queryContentVersion = 'SELECT Id, ContentDocumentId, ContentSize,' + String.escapeSingleQuotes(fieldsParameter) + ' FROM ContentVersion'; - System.debug(queryContentVersion); - List filesList = Database.query(String.escapeSingleQuotes(queryContentVersion) + ' WHERE ContentDocumentId IN :fileIds AND Title LIKE :searchTerm WITH SECURITY_ENFORCED ORDER BY LastModifiedDate DESC LIMIT :queryLimit'); + String queryContentVersion = 'SELECT Id, ContentDocumentId, ContentSize,' + String.escapeSingleQuotes(fieldsParameter) + ' FROM ContentVersion'; + List filesList = Database.query(String.escapeSingleQuotes(queryContentVersion) + ' WHERE ContentDocumentId IN :fileIds AND Title LIKE :searchTerm WITH USER_MODE ORDER BY LastModifiedDate DESC LIMIT :queryLimit'); return filesList; } else { @@ -33,15 +30,14 @@ public with sharing class FilesListController { @AuraEnabled(Cacheable=true) public static List getAllRelatedList(String recordId, String fieldsParameter, Integer queryLimit) { - List files = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId ]; + List files = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId WITH USER_MODE ]; ListfileIDs = new List(); for (ContentDocumentLink fileLink : files){ fileIDs.add(fileLink.ContentDocumentId); } - String queryContentVersion = 'SELECT Id, ContentDocumentId, ' + String.escapeSingleQuotes(fieldsParameter) + ' FROM ContentVersion'; - System.debug(queryContentVersion); + String queryContentVersion = 'SELECT Id, ContentDocumentId, ' + String.escapeSingleQuotes(fieldsParameter) + ' FROM ContentVersion'; if(Schema.sObjectType.ContentVersion.isAccessible()){ - List filesList = Database.query(String.escapeSingleQuotes(queryContentVersion) + ' WHERE ContentDocumentId IN :fileIds WITH SECURITY_ENFORCED ORDER BY LastModifiedDate DESC LIMIT :queryLimit'); + List filesList = Database.query(String.escapeSingleQuotes(queryContentVersion) + ' WHERE ContentDocumentId IN :fileIds WITH USER_MODE ORDER BY LastModifiedDate DESC LIMIT :queryLimit'); return filesList; } else { @@ -52,7 +48,7 @@ public with sharing class FilesListController { @AuraEnabled(cacheable=true) public static Integer getTotalCount(String recordId){ if(Schema.sObjectType.ContentDocumentLink.isAccessible()){ - AggregateResult totalAggregateCount = [SELECT count(ContentDocumentId) total FROM ContentDocumentLink WHERE LinkedEntityId = :recordId WITH SECURITY_ENFORCED ]; + AggregateResult totalAggregateCount = [SELECT count(ContentDocumentId) total FROM ContentDocumentLink WHERE LinkedEntityId = :recordId WITH USER_MODE ]; Integer count = (Integer)totalAggregateCount.get('total'); return count; } diff --git a/classes/FilesListController.cls-meta.xml b/classes/FilesListController.cls-meta.xml index db9bf8c..5f399c3 100644 --- a/classes/FilesListController.cls-meta.xml +++ b/classes/FilesListController.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 Active diff --git a/classes/FilesListControllerTest.cls-meta.xml b/classes/FilesListControllerTest.cls-meta.xml index db9bf8c..5f399c3 100644 --- a/classes/FilesListControllerTest.cls-meta.xml +++ b/classes/FilesListControllerTest.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 Active diff --git a/lwc/downloadFilesModal/downloadFilesModal.js-meta.xml b/lwc/downloadFilesModal/downloadFilesModal.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/downloadFilesModal/downloadFilesModal.js-meta.xml +++ b/lwc/downloadFilesModal/downloadFilesModal.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/emptyIllustration/emptyIllustration.js-meta.xml b/lwc/emptyIllustration/emptyIllustration.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/emptyIllustration/emptyIllustration.js-meta.xml +++ b/lwc/emptyIllustration/emptyIllustration.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/fileCard/fileCard.js b/lwc/fileCard/fileCard.js index ff073ca..979034d 100644 --- a/lwc/fileCard/fileCard.js +++ b/lwc/fileCard/fileCard.js @@ -125,7 +125,7 @@ export default class ContactDataTable extends NavigationMixin( this.filesData = undefined; this.filesError = result.error; } - if (this.filesData && this.objectInfoData.apiName === "ContentVersion") { + if (this.filesData && this.objectInfoData && this.objectInfoData.apiName === "ContentVersion") { this.createDataTableColumns(); } } @@ -200,7 +200,7 @@ export default class ContactDataTable extends NavigationMixin( this.objectInfoData = undefined; this.objectInfoError = result.error; } - if (this.filesData && this.objectInfoData.apiName === "ContentVersion") { + if (this.filesData && this.objectInfoData && this.objectInfoData.apiName === "ContentVersion") { this.createDataTableColumns(); } } diff --git a/lwc/fileCard/fileCard.js-meta.xml b/lwc/fileCard/fileCard.js-meta.xml index 97aadc3..829f0cb 100644 --- a/lwc/fileCard/fileCard.js-meta.xml +++ b/lwc/fileCard/fileCard.js-meta.xml @@ -1,6 +1,6 @@ - 48.0 + 63.0 Enhanced Files List true diff --git a/lwc/mobileDataTable/mobileDataTable.js-meta.xml b/lwc/mobileDataTable/mobileDataTable.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/mobileDataTable/mobileDataTable.js-meta.xml +++ b/lwc/mobileDataTable/mobileDataTable.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/mobilePanel/mobilePanel.js-meta.xml b/lwc/mobilePanel/mobilePanel.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/mobilePanel/mobilePanel.js-meta.xml +++ b/lwc/mobilePanel/mobilePanel.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/mobileSortButtonMenu/mobileSortButtonMenu.js-meta.xml b/lwc/mobileSortButtonMenu/mobileSortButtonMenu.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/mobileSortButtonMenu/mobileSortButtonMenu.js-meta.xml +++ b/lwc/mobileSortButtonMenu/mobileSortButtonMenu.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/noFilesView/noFilesView.js-meta.xml b/lwc/noFilesView/noFilesView.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/noFilesView/noFilesView.js-meta.xml +++ b/lwc/noFilesView/noFilesView.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/paginator/paginator.js-meta.xml b/lwc/paginator/paginator.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/paginator/paginator.js-meta.xml +++ b/lwc/paginator/paginator.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/photo/photo.js-meta.xml b/lwc/photo/photo.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/photo/photo.js-meta.xml +++ b/lwc/photo/photo.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/photoModal/photoModal.js-meta.xml b/lwc/photoModal/photoModal.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/photoModal/photoModal.js-meta.xml +++ b/lwc/photoModal/photoModal.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/pubsub/pubsub.js-meta.xml b/lwc/pubsub/pubsub.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/pubsub/pubsub.js-meta.xml +++ b/lwc/pubsub/pubsub.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file diff --git a/lwc/uploadFilesModal/uploadFilesModal.js-meta.xml b/lwc/uploadFilesModal/uploadFilesModal.js-meta.xml index 605287e..41719fe 100644 --- a/lwc/uploadFilesModal/uploadFilesModal.js-meta.xml +++ b/lwc/uploadFilesModal/uploadFilesModal.js-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 63.0 false \ No newline at end of file