function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neao18neao18 

Why this update map code is not comming in debug

this is the trigger code: trigger InsertUpdateCon on ConTest__c (after insert, after update, before insert, before update) { if(Trigger.isAfter && Trigger.isInsert){ UpdateDateFromMaster accob= new UpdateDateFromMaster(Trigger.new); } } and this is class: public class UpdateDateFromMaster{ public UpdateDateFromMaster(List accTest){ Map accMap= new Map(); Set accId=new Set(); system.debug('#### map'+accTest); for(ConTest__c con: accTest){ accId.add(con.AccTest__c); } for(AccTest__c acc: [select Id,Name,Close_Date__c from AccTest__c where Id =:accId]){ accMap.put(acc.Id,acc); } system.debug('#### map'+accMap); Date Ob= date.today()+20; for(ConTest__c con: accTest){ if(accMap.containsKey(con.AccTest__c)){ accMap.get(con.AccTest__c).Close_Date__c=Ob; } } if(accMap != null){ update accMap.values(); } } }
Best Answer chosen by Admin (Salesforce Developers) 
ForceMantis (Amit Jain)ForceMantis (Amit Jain)

Hi Neao18

 

If I understand the problem well you are saying that debug statements that you put in your code are not coming in debug logs?

 

You have written Trigger on many events while you are executing code only on After Insert, so first you have to create new record for your code to execute. Are you doing it correctly?