1

User is getting "There's a problem saving this record. You might not have permission to edit it, or it might have been deleted or archived. Contact your administrator for help." exception for a record.

Scenario: User is trying to delete the record which is created by any other user. The object is set with Public Read/Write org-wide sharing settings and the user is assigned with Read/Create/Edit/Delete permission for the object through permission set.

Problem Statement: User is getting above mentioned error while trying to delete the record created by another user. And this exception is not even firing the trigger to debug more.

P.S. Only with "Modify All" access users are able to delete the records but it is not recommended to provide this permission to the users other than system admin.

Thanks in advance for the input.

3
  • check your role. i think they prevent this by using role hierarchy Commented Jan 24, 2019 at 11:42
  • @cloudZigZag Role hierarchy has not been set up for the Org. Commented Jan 24, 2019 at 12:32
  • Have you tried querying the UserRecordAccess object to check if the user has delete access on the record?
    – Sean
    Commented Dec 24, 2020 at 15:13

2 Answers 2

0

There are only two possible ways wherein you can delete a record which is not owned by you and has OWD as public read/write.

  1. The user trying to delete the record is higher in the role hierarchy than the owner of the record. (i.e. should be in the same branch in role hierarchy)
  2. The user trying to delete the record has "Modify All" permission on that object or has "Modify All Data" permission on profile/permission set.
0

Role hirarchy is necessary to delete the record with "Delete" permission on profile / permission set + "Read/write" as OWD on that object.

If you don't want role hiererchy enabled for that object then you should have OWD "Read/Write" + "Modify All data" permission

If you want to give the permission through permission set then

  1. create a custom permission and set the value to true in your existing permission set.
  2. Create a custom button with Apes + VF/Lightning
  3. In Apex code if the current user has that permission set assigned if so delete the record through apex.
1
  • Role Hierarchy is not enabled for the org. Is there any other way around? I just checked even with Sharing rule it is not possible to achieve this. Commented Jan 24, 2019 at 12:30

You must log in to answer this question.

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