-
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

How To Leverage The Power of Salesforce For Manufacturing?
Manufacturing industries are facing immense pressure to modernize operations and reinvent themselves. Gaining visibility into key customer metrics, a streamlined collaboration between disparate departments, and…

Salesforce Summer '22 Release - Go Through the Highlights
Lather on the sunscreen and pour a cold glass of lemonade; warm weather is here, which means it's time for Salesforce's Summer '22 update release!…

Introduction on Salesforce and HIPAA Compliance
HIPAA stands for ‘The Health Insurance Portability and Accountability. As per HIPAA, it was established in the year 1996 that all the data related to…
Popular Salesforce Videos
Salesforce Platform Developer 1 Certification Training | Salesforce Training Video
This Salesforce Training Video will give an overview of Salesforce Certification Training by explaining what is Salesforce, Why we need Salesforce, Salesforce Career opportunities and…
Lightning Component Development - Applying Stylesheet, Create Basic Lightning Component
Welcome to Lightning Component Development Sessions. This is the initiative to help Salesforce Community in learning Lightning which we believe is future of Salesforce. Check…
Simple Salesforce to Salesforce Data Migration Step by Step | 100% Salesforce Native App
How to Migrate Salesforce Data? Create Template: As the name suggests, this is just like a sandbox template; these templates store template lines & various…