Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam PDI Topic 10 Question 83 Discussion

Actual exam question for Salesforce's Platform Developer I exam
Question #: 83
Topic #: 10
[All Platform Developer I Questions]

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?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Van
2 months ago
That's a good point. It's important to make sure the code efficiently updates all the Assets.
upvoted 0 times
...
Norah
2 months ago
I see your point. But adding List assets to line 14 and iterating over the list on line 15 could also work.
upvoted 0 times
...
Jaleesa
2 months ago
I agree with Van, moving the logic to a Queueable class seems like a more organized approach.
upvoted 0 times
...
Van
2 months ago
But wouldn't moving all the logic to a Queueable class be a better solution?
upvoted 0 times
...
Virgie
3 months ago
Personally, I'd go with A. Consolidating the Account queries seems like the most efficient way to handle this.
upvoted 0 times
Alberta
2 months ago
I'm leaning towards option D, it seems like a good approach to me.
upvoted 0 times
...
Sherell
2 months ago
I think option C could also work well in this situation.
upvoted 0 times
...
Carlton
2 months ago
Personally, I'd go with A. Consolidating the Account queries seems like the most efficient way to handle this.
upvoted 0 times
...
Kelvin
2 months ago
I agree, option A seems like the best choice here.
upvoted 0 times
...
Stefanie
3 months ago
B) Add a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an Account.
upvoted 0 times
...
Dominga
3 months ago
A) Change the gerAssetsToUpdac= method to process all Accounts in one call and call it outside of the for loop that starts on line 03.
upvoted 0 times
...
...
Norah
3 months ago
I believe adding a LIMIT clause to the SOQL query on line 16 could help with the failure.
upvoted 0 times
...
Carrol
3 months ago
Hmm, I'm not sure about that. Doesn't D seem like the simplest solution? Just iterate over the Assets directly instead of querying them in the trigger.
upvoted 0 times
Lorita
2 months ago
D) Add List assets = [SELECT Id, Status__c FROM Asset WHERE AccountId = :acctId] to line 14 and iterate over the assets list in the for loop on line 15.
upvoted 0 times
...
Dion
3 months ago
D) Add List assets = [SELECT Id, Status__c FROM Asset WHERE AccountId = :acctId] to line 14 and iterate over the assets list in the for loop on line 15.
upvoted 0 times
...
Leanora
3 months ago
B) Add a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an Account.
upvoted 0 times
...
Ma
3 months ago
A) Change the gerAssetsToUpdac= method to process all Accounts in one call and call it outside of the for loop that starts on line 03.
upvoted 0 times
...
Danica
3 months ago
A) Change the gerAssetsToUpdac= method to process all Accounts in one call and call it outside of the for loop that starts on line 03.
upvoted 0 times
...
...
Van
3 months ago
I think we should change the gerAssetsToUpdate method to process all Accounts in one call.
upvoted 0 times
...
Earnestine
4 months ago
But wouldn't adding a LIMIT clause to the SOQL query help with limiting the number of Assets queried?
upvoted 0 times
...
Lucina
4 months ago
I think C is the way to go. Offloading the logic to a Queueable class is a more scalable approach.
upvoted 0 times
...
Makeda
4 months ago
Option B sounds like the best solution to me. Limiting the number of Assets queried will help prevent the limit failures.
upvoted 0 times
Willodean
2 months ago
Let's implement these changes and see if it resolves the issue with the nightly integration.
upvoted 0 times
...
Corrina
3 months ago
That's a good idea. It could help improve the overall performance of the integration.
upvoted 0 times
...
Kizzy
3 months ago
Maybe we can also look into asynchronous processing to handle bulk updates more effectively.
upvoted 0 times
...
Emerson
3 months ago
That's a good point. It should help with the limit failures.
upvoted 0 times
...
Corinne
3 months ago
Agreed. It's important to find a balance between functionality and efficiency.
upvoted 0 times
...
Lenna
3 months ago
B) Add a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an Account.
upvoted 0 times
...
Joni
3 months ago
We should consider optimizing the code to avoid hitting limits.
upvoted 0 times
...
Lindsay
3 months ago
That's a good point. It could definitely help with the limit failures.
upvoted 0 times
...
Denny
4 months ago
B) Add a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an Account.
upvoted 0 times
...
...
Colene
4 months ago
I believe moving all logic to a Queueable class could also be a good solution.
upvoted 0 times
...
Sue
4 months ago
I agree with Earnestine, calling it outside of the for loop should help with the limit failures.
upvoted 0 times
...
Earnestine
4 months ago
I think we should change the gerAssetsToUpdac method to process all Accounts in one call.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77