4

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.

  • 2
    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 '18 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. – Jason Clark Aug 27 '18 at 14:58
  • 2
    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. – Jason Clark Oct 17 '18 at 14:39
0

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:

Type.forName('TaskRelation').newInstance();

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.

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.