-
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 Automation — Business Cases
In this series of articles about Salesforce Automation, we have explained and demonstrated how each of the automation tools can be used and provided an…
New Salesforce Digital 360 Features
Salesforce, the world's leading CRM company, unveiled new Digital 360 technologies to help businesses go digital faster and deliver the next generation of marketing, commerce,…
Popular Salesforce Videos
Salesforce Admin Certification 2020 Questions Explained with References - Part I
How to prepare and pass Salesforce Admin Certification with Practice Exam Questions 2020 practice questions and answers for the Salesforce Administration Salesforce Certified Admin Exam…
How to Start a Process with Parameters on UiPath Robots from Salesforce Interface
How to start a process with parameters on UiPath Robots from the Salesforce interface. Watch this video and learn. Let us know in the comments…
Easy Way to Learn Salesforce | How to Learn Salesforce Step by Step
In this video on Easy Way to Learn Salesforce, you will learn introduction to Salesforce, how to learn Salesforce easily, Salesforce as Career and Growth,…