-
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 Marketing Cloud Implementation Guide
Table of Contents Introduction to Salesforce Marketing Cloud (SFMC) Key Features of Salesforce Marketing Cloud Reasons to Adopt Marketing Cloud for Your Business Salesforce Marketing…
How Sales Cloud Helps Companies Reduce Long Sales Cycles
In today’s competitive market, reducing the length of the sales cycle has become a key driver of revenue growth. According to CSO Insights’ 2023 Sales…
Popular Salesforce Videos
Salesforce For Non Programmers | Salesforce For Non Technicals
You can learn Salesforce without any programming language. You can plan Salesforce Administrator Certification which requires no coding skills. Watch this video to learn how.
Client Side Search in Lightning Component Salesforce | Lightning Data Table
In this video, I will implement the Client-Side Search functionality in Lightning Data Table in a Custom Lightning Component. Client-Side Search allows users to search…
Reassign Leads using Lead Assignment Rule on Update/Upsert | Salesforce Tutorials | #SalesforceBolt
In this vlog, we will do some work around Assignment Rules. As you are aware Assignment Rule can be trigger on Insert actions. Either it…