Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Update DisplayCaseController.cls #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions DisplayCaseController.cls
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
public class DisplayCaseController {
public with sharing class DisplayCaseController {

@AuraEnabled
public static Case getCaseFromId(Id caseID) {
List<Case> cases = new List<Case>();

if(caseID == null) {
return [SELECT ID, Subject, Description, STATUS from Case LIMIT 1];
cases = [SELECT Id, Subject, Description, STATUS from Case LIMIT 1];
} else {
cases = [ SELECT Id, Subject, Description, Status from CASE where ID = :caseID ];
}

List<Case> cases = [ SELECT Id, Subject, Description, Status from CASE where ID = :caseID ];
SObjectAccessDecision securityDecision = Security.stripInaccessible(
AccessType.READABLE, cases);

cases = securityDecision.getRecords();
System.debug(cases);
if(cases.size() == 0) {
return [SELECT ID, Subject, Description, STATUS from Case LIMIT 1];
return null;
} else {
return cases[0];
}
}


}
}