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