I have a scenario where I have an Apex code that runs two inserts on my custom objects, and they can't be bulkified because the Id of the first insert is used in the second one.
I have an
after trigger that updates some fields. To avoid recursion, i used a static variable pattern.
Turns out, when we do
insert obj1; insert obj2;
Those are still the same transaction, so static variable is not reset. Apart from manually resetting it in my code (which i can do, but any other packages/code using my custom object unaware of this won't know to do this) is there a way to reset this or some other way to avoid recursion?