You need to sign in to do that
Don't have an account?
SupriyaH9
Controlling multiple recursive triggers in one transaction?
Little confused about the scope of a static variable here. I have 2 scenarios:
- Two recursive trigger methods A and B in the same transaction - Does it mean will I need two static variables a and b to apply the recursion control for each one? And if this is true, does this mean I will need , e.g. 6 static variables doing the same thing to control 6 recursive methods in a single transaction? 😮
- How does this scenario differ when I rather have 2 users instantiating the same transaction at the same time?
There would be 2 transactions for 2 users, So static variables scope would be different for each user/transaction. Please see below salesforce documents.
"A static variable is static only within the scope of the Apex transaction. It's not static across the server or the entire organization. The value of a static variable persists within the context of a single transaction and is reset across transaction boundaries."
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_static.htm
Hope this help.
Thanks
http://takesurvey.onl/
Because the static variable retains it's value for the scope of the transaction, for one method I will need the value of a static boolean true and for the other, I will need to be false - and in order to achieve this, I need to have 2 differnt variables. just one would not suffice.
More conditions need more static variables to control over them.
Thanks