From 363a196fe4cd0595364d31e618567f9a0837b895 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Tue, 13 Sep 2022 10:51:43 -0400 Subject: [PATCH] Fixed #363 by correcting some references in the migration script --- ...igrate-log-scenario-field-to-logger-scenario-object.apex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/data/migrate-log-scenario-field-to-logger-scenario-object.apex b/scripts/data/migrate-log-scenario-field-to-logger-scenario-object.apex index a9f2defe5..31fd49f4c 100644 --- a/scripts/data/migrate-log-scenario-field-to-logger-scenario-object.apex +++ b/scripts/data/migrate-log-scenario-field-to-logger-scenario-object.apex @@ -10,13 +10,13 @@ if (countOfRecordsToUpdate == 0) { System.debug(countOfRecordsToUpdate + ' Log__c records have legacy field Scenario__c set but not LoggerScenario__c'); -Map scenarioNameToLogScenario = new Map(); +Map scenarioNameToLoggerScenario = new Map(); List logsToUpdate = [SELECT Id, TransactionScenario__c, Scenario__c FROM Log__c WHERE TransactionScenario__c = null AND Scenario__c != null LIMIT :Limits.getLimitDmlRows()]; for (Log__c log : logsToUpdate) { - scenarioNameToLogScenario.put(log.TransactionScenario__r.UniqueId__c, log.TransactionScenario__r.clone()); log.TransactionScenario__r = new LoggerScenario__c(UniqueId__c = log.Scenario__c); + scenarioNameToLoggerScenario.put(log.Scenario__c, log.TransactionScenario__r.clone()); } -upsert scenarioNameToLogScenario.values() UniqueId__c; +upsert scenarioNameToLoggerScenario.values() UniqueId__c; update logsToUpdate; countOfRecordsToUpdate = [SELECT COUNT() FROM Log__c WHERE TransactionScenario__c = null AND Scenario__c != null];