You need to sign in to do that
Don't have an account?

Adding a public event
I am trying to create a trigger that will take information from a sObject we have created and use it to create a new public event. I found some code for a recurring event and I figured I could tweak it to create the events I am aiming for. The problem is that even though the code compiles fine, when I create a new record in our sObject I can not find the event that was supposed to be created. What am I missing?
trigger aClassTrigger on LGA__c (after insert) {
Map<String, LGA__c> clasMap = new Map<String, LGA__c>();
// after LGA are inserted
List<Event> lgaEvents = new List<Event>();// build list in memory
for (LGA__c clas : System.Trigger.new) {
date t = clas.LGA_Date__c;
datetime xStartDate = DateTime.newInstance(t.year(),t.month(),t.day());
Event event = new Event(
ActivityDate = clas.LGA_Date__c ,
RecurrenceEndDateOnly = clas.End_Date__c ,
RecurrenceStartDateTime = xStartDate,
RecurrenceType = 'RecursEveryWeekday',
RecurrenceDayofWeekMask = 1,
IsRecurrence = TRUE,
Description = 'Class Event.',
Event_Type__c = 'Customer Training',
Call_Objective__c = 'training',
Location = 'here',
IsAllDayEvent = TRUE,
Event_Status__c = 'Not Started',
Subject = 'Class trigger Event');
lgaEvents.add(event); // add to list
}
}
Where are you actually creating the event? I see you creating a list, creating a new object of event and adding it to the list, but no where do I see an Insert dml command.
Try adding "insert lgaEvents;" to your trigger. That will actually create the invite as a record instead of a temporary file.
All Answers
Where are you actually creating the event? I see you creating a list, creating a new object of event and adding it to the list, but no where do I see an Insert dml command.
Try adding "insert lgaEvents;" to your trigger. That will actually create the invite as a record instead of a temporary file.
That did it. I have a lot to learn when it comes to Apex :) Thanks for the help.