1

I'm trying to understand the Event sharing rules, as I have an Email Service that will run with minimal permissions and that needs to query Events by ID (event IDs will be present in the emails). This works unless there are no contacts associated to an Event.

In an org with Shared Activities enabled and the following Org-Wide Defaults for Sharing:

  • Account, Contract and Asset: Public Read/Write
  • Contact: Controlled by Parent
  • Activities: Controlled by Parent

For any Event created with at least one Contact attending (such that Event.WhoId is populated), the "parent" of the event appears to be the Contact, and since Account sharing is Public Read/Write, everyone can see the Event; the Email Service can find the event. But if I create an event without a Contact, the email service cannot query the Event by Id. Adding a contact after initially creating the event does fix the issue for a given Event. Also - none of these Events have WhatIds assigned.

If an Event is created without a WhoId or WhatId, does it effectively have no parent? Is there any way to make it visible to other users who do not have "View all data" permissions?

  • Where are you accessing event, i mean you have created a vf page to see all events? or you are using standard UI? – Pragati Jain Oct 25 '18 at 14:42
  • @PragatiJain As stated, I have an Email Service - an Apex class that implements Messaging.InboundEmailHandler. developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… – Jason Clark Oct 25 '18 at 14:47
  • Ah, I missed that one. I am not sure but you can try one thing. Write down a class which explicitly work in without sharing mode and then in that class try to fetch events. – Pragati Jain Oct 25 '18 at 14:49
  • Do you have shared activities enabled? – codeyinthecloud Oct 25 '18 at 14:54
  • @codeyinthecloud Yes, Shared Activities are enabled; question updated. – Jason Clark Oct 25 '18 at 14:59
1

Write down a class which explicitly work in without sharing mode and then in that class fetch events. You can call this class in your email service. By this you will get all event whether they have a parent or not.

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.