Skip to main content
added 32 characters in body
Source Link
Santanu Boral
  • 36.2k
  • 8
  • 45
  • 72

I have one trigger on Opportunity which will copy the value of some Account field into opportunity field. All I'm doing in before trigger because I also have validation rule on opportunity which will fire on opportunity.

But in before trigger my values are not getting updated. here is my code:

for(Opportunity op : Trigger.New){

for(Opportunity op : Trigger.New){

    op.Checkbox1 = op.Account.Wal_Checkbox1;
    op.Checkbox2 = op.Account.Wal_Checkbox2;
    op.Checkbox3 = op.Account.Wal_Checkbox3;
    op.Checkbox4 = op.Account.Wal_Checkbox4; 

}

}

I have one trigger on Opportunity which will copy the value of some Account field into opportunity field. All I'm doing in before trigger because I also have validation rule on opportunity which will fire on opportunity.

But in before trigger my values are not getting updated. here is my code:

for(Opportunity op : Trigger.New){

op.Checkbox1 = op.Account.Wal_Checkbox1;
op.Checkbox2 = op.Account.Wal_Checkbox2;
op.Checkbox3 = op.Account.Wal_Checkbox3;
op.Checkbox4 = op.Account.Wal_Checkbox4;

}

I have one trigger on Opportunity which will copy the value of some Account field into opportunity field. All I'm doing in before trigger because I also have validation rule on opportunity which will fire on opportunity.

But in before trigger my values are not getting updated. here is my code:

for(Opportunity op : Trigger.New){

    op.Checkbox1 = op.Account.Wal_Checkbox1;
    op.Checkbox2 = op.Account.Wal_Checkbox2;
    op.Checkbox3 = op.Account.Wal_Checkbox3;
    op.Checkbox4 = op.Account.Wal_Checkbox4; 

}
Source Link
salesforce Developer
  • 3.4k
  • 12
  • 57
  • 104

Update Record in before trigger

I have one trigger on Opportunity which will copy the value of some Account field into opportunity field. All I'm doing in before trigger because I also have validation rule on opportunity which will fire on opportunity.

But in before trigger my values are not getting updated. here is my code:

for(Opportunity op : Trigger.New){

op.Checkbox1 = op.Account.Wal_Checkbox1;
op.Checkbox2 = op.Account.Wal_Checkbox2;
op.Checkbox3 = op.Account.Wal_Checkbox3;
op.Checkbox4 = op.Account.Wal_Checkbox4;

}