+ Start a Discussion

Programmatic sharing

Hello All,


I need to share Leads/Accounts/Contacts and Opportunities to individuals who are specified in two diff lookup fields in each record. I'm looking at how this can be accomplished - automatically - auto share!!


1. Account teams: This is the best I guess as we use salesforce built in functionality. And each record can have its own account team. Right? But I want to automate this. Like on save of an account record,  i want the team to eb created and automatically the record be shared. I need to write an apex trigger to do this? But Apex Managed Sharing is only available for custom objects according the the apex language reference. (pg 139).

But I have seen that all std objects have an object called AccountShare (instead of customobj_share objects for custom). Can I use this to programmtically assign sharing? if so how? Any examples? But how is this different from apex managed sharing?


2. For opportunities, i use Sales teams?

3. What abt leads?


Any inputs will be greatly appreciated. Thank you