-
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
Introduction to Quickbooks and Salesforce Integration
Cloud Computing has taken over the operations for enterprises, small and medium scale businesses to the virtual cloud. Operations over the cloud are effective in…
Top Picks From Salesforce Spring '21 Release
The all-new Salesforce Spring '21 release is right around the corner. This is an exciting time for all the Salesforce developers, administrators, and consultants. We…
Navigation Service in Lightning Web Component | All You Need to Know
Use the navigation service lightning/navigation to navigate in Lightning Experience, Lightning Communities, and the Salesforce app. Only Lightning Experience, Lightning Communities, and the Salesforce app…
Popular Salesforce Videos
How To Drive More Sales With Marketing Automation in 2023 | Marketing Cloud | Webinar
Are you curious about how to drive more sales for your business? Every business wants to create a market space for its business or product.…
Simplified Non-Functional Testing for Salesforce Developers
Testing is indispensable to measure, optimize performance, and improve user experience. Watch this video to see how you can measure performance across physical mobile devices…
COVID-19 Impact on The Automotive Industry -Digitization With Salesforce Can be a Solution
Coronavirus is expected to create a physical contactless environment with an increased thrust on online assessment and buying of vehicles. This is a huge shift…