function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NishGNishG 

Adding members of a related list to account / opportunity teams

Hi,

 

I have a custom object which is a related list in accounts and / or opportunities.

This custom object has fields to add a number of contacts. When I add contacts to this object, I want those contacts to be automatically added to the account teams and / or opportunity teams.

 

How do you think I can achieve this?

BharathimohanBharathimohan

Hi NishG,

 

You need to acheive this by writing a Apex after Insert Trigger on your Custom Object.

So that whenever a record is inserted, they are automatically added (actually created) in the Acc/Opp teams.

 

This may give you some idea,

 

First Part : Inserting Users in Account Team or Oppty Team

 

1. Select Id, AccountId, UserId, TeamMemberRole, AccountAccessLevel (possible values are READ or EDIT) FROM AccountTeamMember

2. Select Id, OpportunityId, UserId, TeamMemberRole, OpportunityAccessLevel FROM OpportunityTeamMember

 

 

Second Part: Inserting Users in AccountShare or Oppty Share table

 

1. Select Id, AccountId, UserOrGroupId, AccountAccessLevel, OpportunityAccessLevel (possible values are READ or EDIT), CaseAccessLevel(give NONE), ContactAccessLevel(give NONE) FROM AccountShare

2. Select Id, OpportunityId, UserOrGroupId, OpportunityAccessLevel FROM OpportunityShare

 

 

 

Regards,

Bharathi
Salesforce For All

Mark this post as solved, if it helps you