Skip to content

Instantly share code, notes, and snippets.

@mickle00
Last active August 29, 2015 13:59
Show Gist options
  • Save mickle00/10923143 to your computer and use it in GitHub Desktop.
Save mickle00/10923143 to your computer and use it in GitHub Desktop.
List<Case> c = [SELECT Id, isDeleted FROM Case WHERE Id = '500C000000VlnSsIAJ'];
system.debug(c.size()); //1
//Formula field
c = [SELECT Id, Created_During_Business_Hours__c FROM Case WHERE Id = '500C000000VlnSsIAJ'];
system.debug(c.size()); //0
//Created_During_Business_Hours__c uses this field in formula
c = [SELECT Id, Actual_Case_Start_Time__c FROM Case WHERE Id = '500C000000VlnSsIAJ'];
system.debug(c.size()); //0
try{
c = [SELECT Id FROM Case WHERE Id = '500C000000VlnSsIAJ'];
c[0].Subject = 'WHY WONT YOU WORK';
update c;
} catch (Exception e){
system.debug(e);
//12:25:12:123 EXCEPTION_THROWN [15]|System.DmlException: Update failed. First exception on row 0 with id 500C000000VlnSsIAJ; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment