1

In the activity settings you can turn on or off Allow Users to Relate Multiple Contacts to Tasks and Events. But how can I check this in my Apex code? I thought it might be in the Organization table but I dont see anything there.

1 Answer 1

2

Navigate to Setup > Customize > Activities > Activity Settings.

The last checkbox in the list is called Allow Users to Relate Multiple Contacts to Tasks and Events. Helptext:

Enabling this feature lets users relate up to 50 contacts to a task or event (except a recurring task or event).


From Apex, you can inspect the global describe to see if a specific sObjectType is supported:

Boolean isTaskRelationEnabled = Schema.getGlobalDescribe().containsKey('TaskRelation');
4
  • I can see that alright when I navigate there. But if Im doing apex code that will use the TaskRelation table then that table will only exist if that checkbox is checked. So I need to be able to check if it is on or off from Apex Jun 20, 2016 at 20:53
  • @discodowney Updated my answer. It didn't look like you necessarily needed a programmatic solution at first glance.
    – Adrian Larson
    Jun 20, 2016 at 20:55
  • 1
    Cheers Adrian. Works perfectly. Jun 20, 2016 at 20:59
  • Will above query work for Event also ? I can see EventRelation object is already available even multiple contact setting is disabled.
    – San
    Nov 18, 2019 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.