A developer deployed a trigger to update the status__c of Assets related to an Account when the Account''s status changes and a nightly integration that updates Accounts in bulk has started to fail with limit failures.

What should the developer change about the code to address the failure while still having the code update all of the Assets correctly?
Suggested Answer: A
Get Premium DEX-450 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
36 comments · newest first
DU
Dulce
11 months ago
Adding a LIMIT clause seems like a quick fix, but is it really the best solution?
BU
Burma
11 months ago
Wait, can a trigger really handle that many updates without hitting limits?
CO
Cornell
12 months ago
Not sure if moving to a Queueable class is necessary, though.
GA
Gail
12 months ago
I think option C is the best way to handle this.
EL
Elke
1 year ago
Sounds like a classic bulk processing issue!
JA
Jacki
1 year ago
I feel like just iterating over the assets in the for loop might not be efficient enough, but I can't recall if that's a good strategy in this case.
RO
Ronnie
1 year ago
This question reminds me of a similar practice one where we had to optimize a trigger. I think moving logic to a Queueable class could really help here.
LA
Lashawn
1 year ago
I'm not entirely sure, but I think adding a LIMIT clause might just mask the issue instead of solving it.
RE
Ressie
1 year ago
I remember we discussed how bulk processing is crucial to avoid governor limits, so option C seems like a good approach to handle this.
MA
Maxima
1 year ago
This seems straightforward to me. Option A looks like the best solution - we can process all Accounts in one call and avoid the limit issues.
DE
Denae
1 year ago
I'm a bit confused by the code and the options. I'll need to spend some time really understanding what's going on before I can decide on the best solution.
BU
Bulah
1 year ago
Okay, let me think this through. The issue seems to be that the nightly integration is failing due to limit issues, so we need to optimize the code to handle more Accounts and Assets at once. I'm leaning towards Option A or C.
AN
Annalee
1 year ago
Hmm, I think the key here is to find a way to reduce the number of SOQL queries and DML operations to avoid hitting governor limits. Option B or C might be the way to go.
MA
Madalyn
1 year ago
This looks like a tricky one. I'll need to carefully read through the code and the options to figure out the best approach.
WI
Wilda
1 year ago
But wouldn't a primary risk be the original one? This is confusing—I just want to make sure I get this right!
SO
Solange
2 years ago
Option A is just asking for trouble. Trying to process all Accounts in one call? That's just begging for a governor limit exception.
TE
Tegan
2 years ago
Yeah, Option A sounds like a disaster waiting to happen. Processing all Accounts at once is a sure way to hit governor limits.
JE
Jess
2 years ago
I agree, breaking up the processing into smaller chunks will help prevent limit failures. Option A is too risky.
JI
Jina
2 years ago
Option A is definitely risky. It's better to process the Accounts in smaller batches to avoid hitting governor limits.
CO
Colette
2 years ago
Haha, this question is a real head-scratcher. I'm just glad I'm not the one who has to figure it out!
SH
Sherita
2 years ago
I think moving all the logic to a Queueable class and calling it from the trigger could also be a good option.
AG
Agustin
2 years ago
D is the way to do it! Iterating over the Assets list directly is the most straightforward approach in my opinion.
KR
Krystina
2 years ago
Let's go with option D then, hopefully it will fix the issue with the bulk updates.
GE
Geraldine
2 years ago
That makes sense, it should help address the failure with the nightly integration.
BL
Blair
2 years ago
Agreed, iterating over the Assets list directly seems like the way to go.
JO
Josephine
2 years ago
I think D is the best option too. It's the most straightforward approach.
BE
Bernadine
2 years ago
I agree with Viola, changing the code to process all Accounts in one call seems like the best solution.
MA
Marcelle
2 years ago
I'd go with option B. Limiting the number of Assets queried per Account is a simple and effective solution.
MA
Marjory
2 years ago
Let's hope it solves the issue.
VI
Vicky
2 years ago
It should help with the limit failures during the nightly integration.
PR
Precious
2 years ago
That sounds like a good idea.
LE
Leigha
2 years ago
B) Add a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an Account.
VI
Viola
2 years ago
I think the developer should change the code to process all Accounts in one call.
DI
Dino
2 years ago
Option C seems like the way to go. Queueable classes are perfect for handling bulkier operations like this without hitting limits.
CH
Cheryl
2 years ago
Yes, it's a good choice to avoid hitting limits.
BR
Brittani
2 years ago
I agree, Queueable classes are great for bulk operations.