I'm relative new to salesforce, and a want to know if it's a way to access to Activity Settings values from Apex code, as specified in Metadata API, I know it's not natively possible to call Metadata API from Apex, and I'm not interested in implementing some third party lib.

Is there another way to accomplish this? I want to access allowUsersToRelateMultipleContactsToTasksAndEvents setting without Metadata API.


1 Answer 1


For this particular setting, you can get it without touching the Metadata API:

Boolean isEnabled = Schema.getGlobalDescribe().containsKey('TaskWhoRelation'));

From the TaskWhoRelation documentation (emphasis mine):


Represents the relationship between a task and a lead or contacts. This object is available in API version 29.0 and later. This derived object is a filtered version of the TaskRelation object; that is, IsParent is true and IsWhat is false. It doesn’t represent relationships to accounts, opportunities, or other objects.

TaskWhoRelation allows a variable number of relationships: one lead or up to 50 contacts. Available only if you’ve enabled Shared Activities for your organization.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .