You need to sign in to do that
Don't have an account?

EmailMessage object permissions problem: the user does not see incoming emails
We have a custom EmailService for inbound messages written in apex, which is processing Inbound email messages and then showing them in a lightning component.
The type od the received email object is EmailMessage. On the production org, when the system administrator is logged in, he sees all the needed incoming emails (the component is showing them as it should be, querying also works). It all worked well in our sandbox though.
The problem is when the user is logged in. The component does not show any emails and they are not visible also by querying. The problem is I suppose with some permissions, but the EmailMessage object in our org is not customizable when it comes to permissions (everything is set to default and is not changeable). The user has a company community licence. Any help or suggestion would be greatly appreciated.
As you written, Email's are creating from emailService i.e. from system level user. While all the components in lightnings are derived from Logged-in User permissions.
Hope this help!
Thanks,
Gaurav
skype: gaurav62990
All Answers
As you written, Email's are creating from emailService i.e. from system level user. While all the components in lightnings are derived from Logged-in User permissions.
Hope this help!
Thanks,
Gaurav
skype: gaurav62990
Actually EmailMessage is only available for organizations that use Email-to-Case or Enhanced Email, which is automatically enabled for most customers.
Regarding the Community user license.
Community users have read access to EmailMessage if the value for the ParentID field is associated with a case. Otherwise, access is determined by sharing access of the associated task.
Now the email messages are appearing in the component. Another issue was raised, because I have a button to custom delete the email and when I try to do that, debug log is giving me the following error: Delete failed. First exception on row 0 with id 02s5800000H2kFHAAZ; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: [].
While here, the user isn't having any one. To delete a particular record you need to run the class with "without sharing" or I say admin permissions.
Thanks,
Gaurav
Skype: gaurav62990
Delete failed. First exception on row 0 with id 02s5800000H2kFHAAZ; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
And I am only trying to delete an EmailMessage object.
As far I know, by adding "without sharing" keyword on a class should work for you.
You can also, try using @future method but this is another thing. Just in-case it helps.
THanks,
Gaurav
skype: gaurav62990
EXCEPTION_THROWN|[9]|System.DmlException: Delete failed. First exception on row 0 with id 02s5800000He3ktAAB; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
Thank you so much for your help. I appreciate it :)
Are you found a solution to your problem "INSUFFICIENT_ACCESS_OR_READONLY"? I have the same issue.
Thanks in advance.
I've checked:
- EmailMessage.RelatedToId
- EmailMessageRelation.RelationId (with RelationTypes FromAddress and ToAddress)
- Task.WhoId
- Task.WhatId
- TaskRelation.RelationId
- TaskWhoRelation.RelationId
All of these values are equal to emails, sent via Salesforce, but the migrated emails are not visible for normal users, whereas emails send via Salesforce are visible.
Did you find a solution for your INSUFFICIENT_ACCESS_OR_READONLY error, or do you have ideas, what to check?
Thanks in advance.
Have you found an answer to this question of access? I can read the email fine as it is associated with an account and shows up in the Activity timeline but other users cannot open the email even though they see it there. I would love to know how to allow other users read access (at least) to this email.
I loaded all of the historical emails via DataLoader into the EmailMessage object.
Thank you in advance for your answer.
Did anyone find an answer to this ?
Just as mentioned above users can read the email fine as it is associated with an account and shows up in the Activity timeline but users cannot open the email even though they see it there. I would love to know how to allow other users read access (at least) to this email if they are not the opwner of the record.
Hi
Did you find any solution to your problem in my case I have an automated email trigger to client on Account which will run in system context I have written a trigger on Task to change the owner to user who is supposed to view the email message record.
But facing the same issue user is able to view the email on activity tab but user is unable to open the record.
Thank you in advance for the answer