6

Use Case

My users are primarily Service users. They all have Read/Write access (through sharing rules) on all Cases, Contacts and Accounts that they deal with. They collaborate on data grooming - often editing each others' Tasks, Cases, etc. in cases of errors or deleting duplicates.

They need a way to edit a Task that someone else created and that is assigned to a third user.

What I've done

So I read through the documentation and came across the tidbit below, and assigned "Modify All" on Case and Contact to my users. It works.

How to improve it

But I don't like giving such a huge sledgehammer permission away. Though they should be able to modify the Contacts and Cases they have access to, they should absolutely not be allowed to modify or even view some Contacts/Cases that are owned by other teams.

(This is closely related to Providing delete access to records of other users without 'Modify All')

The answer above suggests assigning the tasks to a queue of all of these users, but Tasks cannot live in a Queue. Is there an alternative, where I can assign a task to a person, and allow their colleagues to delete/edit it?

You can edit or delete an activity (in Salesforce Classic only) when the following applies:

  • You have the “Edit Tasks” and “Edit Events” permissions

  • AND:

    • You’re assigned to the activity, or
    • You’re above the user assigned to the activity in the role hierarchy, or
    • You have the “Modify All” object-level permission in the related record, where the record’s sharing model is “Controlled By Parent.”
      (with Shared Activities enabled, you need the “Modify All”
      object-level permission for at least one contact and the related
      record), or
    • You have the “Modify All Data” permission
5
  • 1
    Btw, task cannot be assigned to a queue, I will look into that Commented Jul 2, 2016 at 4:42
  • What is the OWD of task in your org? Commented Jul 2, 2016 at 4:45
  • It sounds like your service users are likely members of a group created for sharing. Have you looked at perhaps creating conditional sharing rules to automatically share related tasks to the members of the group? This would seem to be a reasonable approach if you don't want to give them the Modify All permissions. Presumably, they already would have the sharing on the Case and/or Account to use as the condition to share the Activity with members of that group. Otherwise, you'd be looking at Apex Sharing Rules via a trigger or batch class.
    – crmprogdev
    Commented Jul 2, 2016 at 15:36
  • @crmprogdev Yes, they are members of a Group. But it seems that I cannot add Sharing Rules (Apex or otherwise) to Activities... Commented Jul 3, 2016 at 2:36
  • @SantanuBoral The OWD is Controlled By Parent. The other option is Private. Commented Jul 3, 2016 at 2:37

1 Answer 1

4

There's no general "configuration-only" solution to this problem. You'll need a way to bypass sharing to allow deletion. Here's some choices (some of which are already noted in the comments):

Custom REST/Web Service

Write a "webservice" method, or a @RestResource method. Use "without sharing" to bypass sharing on the tasks.

Visualforce

Write up a page that allows deletion of a specified task. Works the same as above, but uses Visualforce instead of JavaScript.

Trigger

You can actually delete a record in a trigger using "after update". Just make a custom checkbox and have the trigger delete the record when checked. Users will only be able to delete tasks they can edit using this method.

2
  • Since visual workflow can delete records, and can run in system mode, that would work as well in the custom checkbox scenario. Not for button click though as that would be in user mode. I assume process builder can delete records too but haven't tried.
    – gorav
    Commented Jul 3, 2016 at 22:38
  • @sfdcfox - I guess a clean-ish way of doing this may be to create an action override for Delete that does these things. Commented Jul 5, 2016 at 18:45

You must log in to answer this question.

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