1

At present, my organization using the territories(tm 1.0) for sharing accounts. If user want to manual share account to specific territory he can do that in UI.

But we need to feature to account share history tracking so I create the account share history custom object and a batch. Batch runs every day and add records to that object, but there's a problem with deleting shared record. The record from AccountSharing (when user clicks deselect and save from UI) is deleted completely(not transferred to the trash). So I'm not able to get information about who deleted the given sharing.

The question is whether there is an option that I do not know and would help solve the problem?

  • You're saying that when it's created, you create it via a batch, but when it's removed by the user, it's done directly? If so, have you tried creating a trigger to catch that sharing record update on before delete? – crmprogdev Oct 6 '17 at 14:35
  • AccountShare object can't have triggers. – Adamo Oct 7 '17 at 8:09
1

Some ideas in no specific order:

Check if AccountTeamMember assignments go to recycle bin. If they do, it might be worth hiding the Sharing button & instructing users to use that instead (neither AccountShare nor AccountTeamMember allow triggers).

Check if changes done to sharing tables can be subscribed to using Streaming API? Maybe you could have some code that listens to this and reacts...

Worst case - you could reverse the logic. Have a custom object that's can be inserted or deleted and the action would mirror to AccountShare or AccountTeamMember. Hide the Sharing button (again), track this one. That's a storage consideration but it's something.

Last but not least - there's "Event Monitoring" service. No idea if it can track particular edits (especially of sharing data) but it's worth giving it a go?

  • 1. We do not use AccountTeam's – Adamo Oct 7 '17 at 8:10
  • 2. I must check it. 3. Too much works to do. 4. I must check it. Thanks for tips – Adamo Oct 7 '17 at 8:15
  • 2. Streaming API does not support AccountShare object. – Adamo Oct 9 '17 at 7:43
  • 4. EventLogFile is also empty. Any other tips? – Adamo Oct 9 '17 at 9:25
  • Didn't come up with any more ideas, sorry! AccountTeamMember also gets deleted without going to recycle bin so no point in starting to use them. Are you willing to hide the standard Sharing button & write a VF page that mimics it (maybe not the whole expanded view, just basic edits)? But a determined user would still be able to figure out the original url...) – eyescream Oct 9 '17 at 9:51

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.