-
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 Ecosystem, A Successful Philosophy
Since its inception, Salesforce has built its own success on the success of its customers. To ensure this, over the years, it has developed a…
How Does Salesforce Revenue Cloud Benefit Sales and E-Commerce Businesses?
As Sales and E-Commerce business channels are affected by the ongoing pandemic, the generated revenue and customer demands are also deteriorating at an equal pace.…
Top 10 Salesforce Consulting Companies Around the Globe
Building stronger customer relationships is the need of the hour in this technology-driven world. Salesforce, being the #1 CRM platform, helps your business accomplish this goal.…
Popular Salesforce Videos
Ask Me Anything with Salesforce Developers | Lightning Web Components
Join experts Mohith Shrivastava and Greg Whitworth for our monthly feature Ask Me Anything! This 1-hour session on Lightning Web Components is your chance to…
How to Set Up Salesforce Knowledge?
Watch this video to learn how to set up Salesforce Knowledge so you can help your team more easily find answers to common customer requests.…
How to Prepare for a Salesforce Job Interview
Watch this video to learn how to Prepare for a Salesforce Job Interview.