Fixing Template Errors After Template Migration
Problem
Solution
1
2
Step: Add Apex class to toggle the field
public class HasErrorToggler {
public static void toggleBooleanField(List<SObject> records, String fieldName) {
if (records == null || records.isEmpty()) return;
for (SObject rec : records) {
Boolean currentValue = (Boolean) rec.get(fieldName);
rec.put(fieldName, currentValue == null ? true : !currentValue);
}
update records;
}
}3
Last updated
Was this helpful?

