Skip to main content
1 of 3
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

I recommend you use Data Loader for this task.

  1. Export the query you have already written
  2. Manipulate the CSV to set DisqualifiedReason__c and OwnerId to the proper values.
  3. Import the manipulated CSV

You don't need any Apex if you approach the task this way. You can also break the query out into a few discrete chunks to simplify the SOQL.

Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431