Backup_FME_personal/force-app/main/default/classes/ContactTableController.cls

21 lines
840 B
OpenEdge ABL

public with sharing class ContactTableController {
@AuraEnabled(cacheable=true)
public static List<Contact> getContacts(Id parentId) {
if (parentId == null) {
return new List<Contact>();
}
// For demo: assume parent is Account. You can extend to support other parents if needed.
List<Contact> records = [
SELECT Id, Name, Title, Phone, Email, AccountId
FROM Contact
WHERE AccountId = :parentId
ORDER BY LastName, FirstName
LIMIT 5000
];
// Enforce field-level and object-level security
// Remove fields the running user doesn't have access to
SObjectAccessDecision decision = Security.stripInaccessible(AccessType.READABLE, records);
return (List<Contact>) decision.getRecords();
}
}