0

In an Account Object a field called ‘Sales Person‘ and it has lookup relation with the user object. If the user is selected as the salesperson for a record, that user able to see those records, but OWD is private, record owner and admin will not share any records.

  • Is there a reason why you're not leveraging record ownership for this use case? – Amber Neill Boaz Dec 11 '19 at 0:30
2

This appears to me to be a textbook use case for Apex-Managed Manual Sharing.

You'd use a trigger on the Account object to programmatically insert and maintain AccountShare records. The trigger would need to react to changes in the lookup field, as well as to changes of ownership (since Manual sharing records don't survive ownership changes). It'd remove any shares to the previously-assigned Sales Person and create and insert new shares for the new value.

True Apex-Managed Sharing is not available on standard objects.

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.