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
Ranadheer chRanadheer ch 

Hi I wrote a trigger to bring the account team member Userid to account...

Hi I wrote a trigger to bring the account team member Userid to account...The following trigger is updating the value to accoount object...which is fine ...but the problem is its is updating when i click on EDIT & then SAVE on account...Here i need that value is updated when i enter the ACcount team it is possible?

trigger bringAccountTeamMember on Account (before insert, before update) {
    set<ID> Accountids = new set<id>();
    for (Account Acc : {
        List<AccountTeamMember> AccTeam = [ select id, from AccountTeamMember cm
                                            where AccountID = :Accountids
                                             order by limit 1 ];
        if (AccTeam.isEmpty() == false){
           for (AccountTeamMember Accteams : AccTeam) {
                Acc.Account_Team_Member__c =;
Best Answer chosen by Ranadheer ch
Balaji Chowdary GarapatiBalaji Chowdary Garapati
@Randheer Ch

 As of now, Salesforce do not support triggers on AccountTeamMember object, an idea is in progress, hope salesforce gives it in its next release. Below is the idea, vote for it!

As a work around, you can create a visualforce page to add/display account team members, which can drive your logic. And instead of standard related list in the standard detail page layout, you can replace that with a visualforce snippet, though it looks ugly,thats  the only option for now i believe!

Hope it helps: