-
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

Salesforce Marketing Cloud’s Einstein Just Got Better!
Cometh the update, cometh the improvements! With the recent June ‘21 release, Marketing Cloud has seen a couple of key improvements made within the Einstein…

Automate Call Logs Using RingCentral for Salesforce
Hi All, RingCentral one way solution for calling from Salesforce. This app is available on AppExchange, you just need to install it and make some administrator…

Easy Way to Integrate Salesforce CLI with Visual Studio Code
What is Salesforce CLI? Salesforce CLI is a command-line interface that simplifies development and builds automation when working together with your Salesforce org. Use it…
Popular Salesforce Videos
Developer Life in India | An Interview with Salesforce Chef
Timecode: 00:00 Introduction 01:10 Who is Amit Singh? 01:56 Amit has interesting projects 03:58 Amit does technical content, but he is still popular. How? 05:45…
Tips to Crack the Salesforce Administrator Certification Exam in One Go
Do you want to become Salesforce administrator certified? So in this video Shrey has shared the important topics to crack the Salesforce Administrator Exam. Watch…
Salesforce and Disney Studios Join Forces
Salesforce and Disney Studios Content recently announced a five-year innovation partnership to help support Disney filmmakers and marketers using the Salesforce platform. By naming Salesforce…