I need to automate adding
Eventrecords to a
Public Calendar. Is it possible to do so using
Apex? I tried using the
OwnerIdfield, but no luck.
The way I have done this in the past is using a
Custom Object because we already had existing data there, but it would work equally well with a
Custom Setting. The key is just getting the correct Id value and assigning it to
OwnerId, as you suspected.
Calendar_Setting__c setting = Calendar_Setting__c.getInstance(CALENDAR_NAME); if (setting != null) someEvent.OwnerId = setting.CalendarId__c;