-
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 Shield: Features, Benefits, and Implementation
Salesforce Shield, a component of Salesforce Platform, is a security solution that secures your company with point-and-click capabilities to improve transparency, governance, trust, and compliance…
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…
All You Need to Know About Service Console in Salesforce
Salesforce is a popular cloud-based Customer Relationship Management (CRM) platform that provides businesses with a variety of tools for managing their customer interactions. The Service…
Popular Salesforce Videos
Agile in Salesforce | Agile Salesforce Implementation
Watch this video to learn about Agile Salesforce Implementation When Salesforce met Agile Agile vs Waterfall Introduction to Scrum Scrum Roles Scrum Ceremonies Q&A
Salesforce Freelance Consulting - Course Preview
The Salesforce Freelance Consultant Course is finally live! Please comment and let me know what questions you have about whether this is a good fit…
Setting Up Service Territories and Operating Hours | Salesforce Webinar
Scale your business and ensure optimized performance by setting up service territories in Salesforce Field Service. In Salesforce Field Service, operating hours represent service territory…