-
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
Why Your Business Needs to Integrate Salesforce with Jira - Top 6 Reasons
For every business, the customer is God! To prevent their fury, they leave no stone unturned to increase the smile on their face. For that,…
Learn All About the Dashboards in Salesforce
What Is a Dashboard? A dashboard is a visual display of key measurements and patterns for records in your organization. The Dashboard and report are…
The Fundamentals of Salesforce CDP
In the realm of marketing, every little thing you do has the power to make or break your business. While many tried and tested marketing…
Popular Salesforce Videos
Salesforce Exam Dumps - Are They Worth It?
In this video, Brad discusses the unethical, yet common, practice of using Exam Dumps to pass a certification exam. These dumps are not only immoral,…
4 Myths About Salesforce
Salesforce is a platform that helps businesses track the journey their customers take. It can help you effectively track and monitor your marketing and sales…
Create Custom Object and Tabs in Salesforce Lightning Experience
In this video, Sanjay Gupta Tech School explains how to create custom objects and tabs in Salesforce Lightning Experience. Watch this video and learn all…