0

Class:

public class Hr {
  public static Boolean f_t = true;
}

Trigger:

trigger HandleTrigger on Input__c (before insert) {
if(Trigger.isInsert){
        if(Hr.f_t){

    Input__c acc = new Input__c(YourMail__c='[email protected]');
      Hr.f_t=false; 
            //acc.YourMail__c='[email protected]';           
            insert acc;
}
}
}

enter image description here

1 Answer 1

3

Your trigger is creating a second record rather than updating the first record. You'd want to change your code as follows:

trigger HandleTrigger on Input__c (before insert) {
    for(Input__c record: Trigger.new) {
        record.YourEmail__c = '[email protected]';
    }
}

Recursion blocking is not necessary in this case.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .