+ Start a Discussion
bs881026bs881026 

can we edit the Values of Trigger.new in Before or After Trigger ?

Can we edit the Value Of Trigger.new in Before or After Trigger . If yes then in which case ? 

Thanks,
Best Answer chosen by bs881026
sfdc_ninjasfdc_ninja
You can use an object to change its own field values using trigger.new, but only in before triggers. In all after triggers, trigger.new is not saved, so a runtime exception is thrown.

See here:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_context_variables_considerations.htm

All Answers

sfdc_ninjasfdc_ninja
You can use an object to change its own field values using trigger.new, but only in before triggers. In all after triggers, trigger.new is not saved, so a runtime exception is thrown.

See here:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_context_variables_considerations.htm
This was selected as the best answer
harsha__charsha__c
Yes, in case of before events

Regards,
- Harsha