Skip to content

Instantly share code, notes, and snippets.

@cdeckert
Created September 20, 2014 07:39
Show Gist options
  • Save cdeckert/ac99ab8afc882ea759be to your computer and use it in GitHub Desktop.
Save cdeckert/ac99ab8afc882ea759be to your computer and use it in GitHub Desktop.

Revisions

  1. cdeckert created this gist Sep 20, 2014.
    12 changes: 12 additions & 0 deletions massupdate.cls
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    public void massUpdate() {
    // first loop (don't forget to use Lists
    for (List < Contact > contacts: [SELECT FirstName, LastName FROM Contact]) {
    for (Contact c: contacts) { // 2nd for loop
    if (c.FirstName == 'Barbara' &&
    c.LastName == 'Gordon') {
    c.LastName = 'Wayne';
    }
    }
    update contacts; // update is part of the 1st for loop
    }
    }