I am trying to write a trigger that will automatically create a campaign record when a new account is created. Below is my code:
trigger AddCampaign on Account(after insert) {
List<Campaign> myCamp = new List<Campaign>();
for(Account a : Trigger.New) {
myCamp.add(new Campaign(Name=a.Name + ' Campaign',
Type='Webinar',
StartDate=System.today().addMonths(1)
));
}
insert myCamp;
}
For some unknown reason the code is not working and it is not showing any error as well. Please help.