+ Start a Discussion
sultansultan 

can we write upsert statement in a Trigger?

Denis VakulishinDenis Vakulishin
Yes,
But be careful if you upserting the same type sObjects. it could cause infinite loop.
sultansultan
could you expand clearly
Denis VakulishinDenis Vakulishin
Hi,
 check this. https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_context_variables_considerations.htm

Also when your're updating objects of the sma type as trigger, you can go in recursion
Check this workaround.
http://help.salesforce.com/apex/HTViewSolution?id=000133752&language=en_US (http://help.salesforce.com/apex/HTViewSolution?id=000133752&language=en_US)