
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18trigger trgTaskJudgementDateCannotBeBlank on Task (before update) { Set<Id> ids = new Set<Id>(); for(Task t:Trigger.New){ if(t.Status=='Completed' && (t.Task_Reference__c =='L-739-5' || t.Task_Reference__c =='L-739-10')){ ids.add(t.WhatId); } List<Trial__c> trialObj = [select Judgement_Date__c from Trial__c where id IN: ids]; for(Trial__c tr: trialObj){ if(tr.Judgement_Date__c == NULL){ t.addError('Please enter a judgement date for this trial record'); } } } }2 réponses
Hi Christopher,You are writing a query inside the for loop because of which you are facing 101 SOQL issue. Can you copy paste the entire code so I can share you the updated one as some of the part of the code is missing.Thanks,