-
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
No Code, Salesforce and SharePoint Integration
Salesforce no doubt is the world's best CRM, it helps organizations building meaningful relationships with their customers. However, there are certain areas where integrating external…
Why Salesforce Data Cloud is No Longer Optional for Modern Salesforce Teams
Businesses generate customer data from multiple touchpoints, including CRM systems, websites, marketing platforms, ERP applications, support channels, and third-party tools. When this information remains scattered…
Popular Salesforce Videos
Introduction To Salesforce Apex | DataType | Collection | Conditional Statements
In this video salesforce apex hours creators provides an introduction to Apex. Apex enables developers to access the Salesforce platform, back-end database and client-server interfaces…
Connect ZOOM with Salesforce | Zapier | Salesforce Tutorials
In this video, you will learn to connect the most usable business video-conferencing application the ZOOM app with Salesforce Org using ZAPIER. I will create…
Salesforce Trailhead - Get Started with the Salesforce Mobile App
After watching this video you'll be able to: Identify the flavors of the Salesforce mobile app available to you. Log in to your Salesforce org…