
5 risposte

Where do you define oCase?Couple thoughts:- If oCase is a List<Case>, declare it as "List<Case> oCase = new List<Case>();".- Since your code only overrides the default value of oCase if caseId != null, it either will be blank list or one for the valid caseId. In either scenario, you can change your upsert to "if (!oCase.isEmpty()) upsert oCase;".- If you are using caseId, you likely only expect one Case. On that hand, you can define "Case oCase;" and use LIMIT 1 in your select to make sure you get a single Case object. In your upsert, you would use "if (oCase != null) upsert oCase;".I hope that helps.