Is there any chance to set up scratch org definition file, to create new scratch orgs with SharedActivities functionality enabled?

We just implemented some functionalities using TaskRelation object, but it fails on deployment to fresh org, because freshly created orgs has disabled SharedActivites.

For sure I edited Activities.settings file, but still, i am getting error during deployment:

You can't use the Tooling API or Metadata API to enable or disable Shared Activities. To enable this feature, visit the Activity Settings page in Setup. To disable this feature, contact Salesforce.

And SFDC docs are confirming that message, that field allowUsersToRelateMultipleContactsToTasksAndEvents

is readonly for mdapi from version 36. I was trying also lower versions but message remains the same.

This is big issue because it breaks our CI-validation process.

I am looking for any way to turn on that setting automaticaly after creating new scratch org, and before starting code deployment.

Every help much appreciated.

  • 3
    I believe this is one of the missing features of DX (there's a few). The Org Shape feature may help you; see if you can get on the pilot.
    – sfdcfox
    Jun 1, 2018 at 20:41
  • If anyone tries this with the Org Shape pilot I'd love to know if it works; I note that the Winter 19 release docs do not contain any mention of a new org setting to control this. Aug 27, 2018 at 14:58
  • 3
    Tried setting in the new settings portion of the scratch org definition file (Winter 19), hoping that since the org is being constructed, you would be allowed to set it. Got the same error message. Oct 17, 2018 at 14:39
  • Org Shape doesn't really seem to do anything, I'm not sure why it was trumpeted so much. I've also confirmed it has no effect on this issue.
    – Andy Ray
    Oct 23, 2022 at 3:39

2 Answers 2


I workarounded that particular problem by switching all queries from static ones

[SELECT Id From TaskRelation];

to Strings, and use Database.query.

For new instances of TaskRelation object, I used:


Thanks to that compiler/validator is not checking types on deployment and build passes.

Of course blocks of code with that workaround needs to be ommited in tests, otherwise deployment will fails anyway, due to unsuporrted type: TaskRelation.


Scratch orgs now support Sharing Activities, this can be enabled by adding SharedActivities into your features section of your scratch org definition.

You must log in to answer this question.

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