Skip to content

Instantly share code, notes, and snippets.

@forcethesales
Created June 26, 2023 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forcethesales/73f8dcf589e77e1169d5256068566a08 to your computer and use it in GitHub Desktop.
Save forcethesales/73f8dcf589e77e1169d5256068566a08 to your computer and use it in GitHub Desktop.
quickly add new campaign member status to all campaigns of Type Email
List<Campaign> exampleTwo = new List<Campaign>([SELECT Id, Name FROM Campaign WHERE Type = 'Email']);
List <CampaignMemberStatus> newStati = new List <CampaignMemberStatus> ();
for (Campaign camp : exampleTwo) {
CampaignMemberStatus newStat = new CampaignMemberStatus();
newStat.CampaignID = camp.Id;
newStat.Label= 'Subscribed';
newStati.add(newStat);
}
insert newStati;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment