-
Adding account team member on account object in Salesforce
trigger TeamMember on Account (after insert) {
if(trigger.isinsert){
for(account acct:trigger.new){
if(acct.ParentId!=null && acct.VPA__c==false){
Account Parentacct=[select id,ownerid from Account where id=:acct.ParentId limit 1];
system.debug(Parentacct +'parentaccount');
Accountteammember acctmem=new Accountteammember();
acctmem.AccountId=acct.id;
system.debug(acct.id +'id');
acctmem.UserId=Parentacct.OwnerId;
acctmem.TeamMemberRole='Account Manager';
system.debug(acctmem +'accounteam');
insert acctmem;
}
}
}
}DML requires SObject or SObject list type: AccountTeamMember on line 13
Log In to reply.
Popular Salesforce Blogs
Choosing The Right Salesforce Implementation Partner
Salesforce implementation partners are crucial parts of management, and the right partner can improve your productivity. However, trying to pick the right partner can be…
What is the Salesforce Analytics Cloud? | The Ultimate Guide
Welcome back to our page! Today, we are going to know about analytics cloud. Salesforce Analytics Cloud, also known as Salesforce Einstein Analytics, is a…
Why Businesses Are Investing in AI Chatbot Development Services in 2026
With the increasing customer expectations and the digital interactions being the major mode of interaction, companies in 2026 are turning to the development services of…
Popular Salesforce Videos
Work With Custom Lightning Components | Salesforce Tutorial
Creating a custom Lightning component requires programming skills. Or, you can install an existing Lightning component from the AppExchange. You can create a custom Lightning…
How to Use a Phone in Salesforce with Dialer for Essentials | Salesforce Essentials
Unify your team with a single company phone number. Lightning Dialer for Essentials lets you and your team close deals and take support calls right…
Apex Performance Tips and Tricks | Salesforce Video Guide
Watch this video to learn all about Apex Performance: • What do we mean by performance? • How do we measure performance? • Loop Performance…