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
Ram_SF14Ram_SF14 

Trigger Context Variables

Hi All 

I am trying to auto populate field from Obj B to Obj A. I have written a trigger,  which is working fine. But I only want to work for before insert and before Update. Can you anyone please help with the correct context variable that needs to used ?

I have used the following for before update it is working fine but not working for insert. Please help

if(trigger.isBefore && trigger.isUpdate){
        OpportunityTriggerHandler.autoPoplate_User(trigger.new);
    }    
Best Answer chosen by Ram_SF14
Ram_SF14Ram_SF14
I found a way of doing it 

 if( trigger.isBefore){
    if( trigger.isInsert || trigger.isUpdate){
            OpportunityTriggerHandler.autoPoplate(trigger.new);
    } }

The above is working