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 Platform Developer I 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
12 months ago
That's a good point. It's important to make sure the code efficiently updates all the Assets.
upvoted 0 times
...
Norah
12 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
12 months ago
I agree with Van, moving the logic to a Queueable class seems like a more organized approach.
upvoted 0 times
...
Van
12 months ago
But wouldn't moving all the logic to a Queueable class be a better solution?
upvoted 0 times
...
Virgie
1 years ago
Personally, I'd go with A. Consolidating the Account queries seems like the most efficient way to handle this.
upvoted 0 times
Alberta
11 months ago
I'm leaning towards option D, it seems like a good approach to me.
upvoted 0 times
...
Sherell
12 months ago
I think option C could also work well in this situation.
upvoted 0 times
...
Carlton
12 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
12 months ago
I agree, option A seems like the best choice here.
upvoted 0 times
...
Stefanie
12 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
1 years 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
1 years ago
I believe adding a LIMIT clause to the SOQL query on line 16 could help with the failure.
upvoted 0 times
...
Carrol
1 years 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
12 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
12 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
1 years 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
1 years 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
1 years 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
1 years ago
I think we should change the gerAssetsToUpdate method to process all Accounts in one call.
upvoted 0 times
...
Earnestine
1 years ago
But wouldn't adding a LIMIT clause to the SOQL query help with limiting the number of Assets queried?
upvoted 0 times
...
Lucina
1 years 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
1 years 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
12 months ago
Let's implement these changes and see if it resolves the issue with the nightly integration.
upvoted 0 times
...
Corrina
1 years ago
That's a good idea. It could help improve the overall performance of the integration.
upvoted 0 times
...
Kizzy
1 years ago
Maybe we can also look into asynchronous processing to handle bulk updates more effectively.
upvoted 0 times
...
Emerson
1 years ago
That's a good point. It should help with the limit failures.
upvoted 0 times
...
Corinne
1 years ago
Agreed. It's important to find a balance between functionality and efficiency.
upvoted 0 times
...
Lenna
1 years 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
1 years ago
We should consider optimizing the code to avoid hitting limits.
upvoted 0 times
...
Lindsay
1 years ago
That's a good point. It could definitely help with the limit failures.
upvoted 0 times
...
Denny
1 years 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
1 years ago
I believe moving all logic to a Queueable class could also be a good solution.
upvoted 0 times
...
Sue
1 years ago
I agree with Earnestine, calling it outside of the for loop should help with the limit failures.
upvoted 0 times
...
Earnestine
1 years ago
I think we should change the gerAssetsToUpdac method to process all Accounts in one call.
upvoted 0 times
...

Save Cancel