[SalesForce] Salesforce Public Calendars query

I want to add event to public Calendars using Apex code in trigger. Currently I have hardcoded id of public Calendar in my code. But I don't want to hardcode id of Calendars. I want to query it in my code. But I am not able to query it as it says sObject type 'Calendar' is not supported.

Any help is appreciated.


Best Answer

I have run into this as well. I am having trouble finding a link to post (I will keep searching), but our workaround is a custom object with a Calendar_Id__c field because we need lookups to this object, otherwise you could use a custom setting to store the names.

Inelegant, perhaps, but you can retrieve them programmatically as you desire.

Related Topic