nerdexam
Salesforce

PDI · Question #227

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 wi

The correct answer is A. Change the gerAssetsToUpdac= method to process all Accounts in one call and call it outside of. The issue is a trigger updating related Assets from Account changes, causing governor limit failures during bulk Account updates; the solution requires asynchronous processing.

Submitted by joshua94· Apr 18, 2026Logic and Process Automation

Question

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?

Exhibit

PDI question #227 exhibit

Options

  • AChange the gerAssetsToUpdac= method to process all Accounts in one call and call it outside of
  • BAdd a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an
  • CMove all of the logic to a Queueable class that queries for and updates the Assets and call it from
  • DAdd List<Asset> assets = [SELECT Id, Status__c FROM Asset WHERE AccountId = :acctId] to

How the community answered

(45 responses)
  • A
    76% (34)
  • B
    4% (2)
  • C
    4% (2)
  • D
    16% (7)

Why each option

The issue is a trigger updating related Assets from Account changes, causing governor limit failures during bulk Account updates; the solution requires asynchronous processing.

AChange the gerAssetsToUpdac= method to process all Accounts in one call and call it outside ofCorrect
BAdd a LIMIT clause to the SOQL query on line 16 to limit the number of Assets queried for an

Adding a LIMIT clause would prevent the trigger from updating all related Assets, which contradicts the requirement to update 'all of the Assets correctly'.

CMove all of the logic to a Queueable class that queries for and updates the Assets and call it from
DAdd List<Asset> assets = [SELECT Id, Status__c FROM Asset WHERE AccountId = :acctId] to

Placing a SOQL query inside a loop (implied by iterating over accounts and querying for each `:acctId`) is a common anti-pattern that leads to governor limit failures during bulk processing.

Concept tested: Asynchronous Apex for bulk processing and governor limits

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_queueing_jobs.htm

Topics

#Apex Triggers#Governor Limits#Bulkification#Apex Best Practices

Community Discussion

No community discussion yet for this question.

Full PDI Practice