3
votes
Accepted
How to avoid nested for loop condition for code optimization & reusability?
tl;dr
Nested loops are fine in some contexts. Here, you may want to enumerate all the fields that are in violation, so the user doesn't have to keep edit/save cycles, or even worse, discard all their ...
2
votes
Triggers on contact to update decsiption field of its parent account
You have queries and DML operations in a loop, both of which are bad. Also, you're querying the records only in the trigger, which would cause the overwriting you've observed. Instead, you'll want to ...
1
vote
How to assign a value to to a field stored in a custom setting?
When you have a string that holds a field name, you need to use SObject's .set() and .get() instead of the normal dot-notation.
c.set(settings.Field__c, 'test');
1
vote
System.LimitException: Too many callouts: 101 Error
The error message is clear that you cannot make more than 100 calls in Transaction (Tx) context. Each time your future job runs, it starts a new Tx context and that execution can make max 100 calls.
...
1
vote
I am trying to split logic from Trigger to handler class with "Method does not exist or incorrect signature: void Error
Your trigger is invoking the handler method like:
OpportunityHandler.handlerAfterDelete(Trigger.old);
This is fine when the handlerAfterDelete method is static, but it is not. You should ensure you ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
trigger × 7552apex × 4814
unit-test × 545
soql × 360
before-trigger × 350
after-trigger × 254
class × 223
workflow × 200
visualforce × 188
code-coverage × 179
opportunity × 153
process-builder × 144
email × 135
case × 126
update × 125
batch × 122
account × 118
future × 112
map × 109
custom-object × 107
community × 106
triggercontext × 105
field-update × 102
bulkification × 102
callout × 95