Timeline for Rewrite apex class to be out of the loop
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 11, 2014 at 16:29 | vote | accept | Blair Kristin | ||
Nov 11, 2014 at 16:22 | comment | added | Keith C | @BlairKristin You need to look at all the detail of the error i.e. class or trigger name and line number. The problem may originate from some other trigger. If you have a line number within your version of the code discussed here post the exact error message (including line numbers) and the exact code in another question. | |
Nov 11, 2014 at 15:56 | comment | added | Blair Kristin | it still gives the cannot specify id on an insert call error for some reason. | |
Nov 11, 2014 at 14:57 | comment | added | Keith C | @BlairKristin I moved both inserts out of the loop. The rule is to not do any DML (modifications like insert/update/upsert/delete) in the loop because if say 200 objects are going into the loop at once that will exceed the 150 DML governor limit. The same is true about doing queries. See Apex Code Best Practices for more detail. | |
Nov 11, 2014 at 14:54 | history | edited | Keith C | CC BY-SA 3.0 |
added 86 characters in body
|
Nov 11, 2014 at 14:46 | history | edited | Keith C | CC BY-SA 3.0 |
added 1621 characters in body
|
Nov 11, 2014 at 14:39 | comment | added | Blair Kristin | thank you for your response. How did you know to just move the accountshare info out of the loop? Is there some sort of rule I can follow? | |
Nov 11, 2014 at 14:28 | history | answered | Keith C | CC BY-SA 3.0 |