-
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
Top Helpful Youtube Channels To Get You Started With Salesforce
Salesforce skills can help advance careers for beginners or for anyone who wants to get into the Salesforce ecosystem. Job seekers can find high-demand, high-paying,…
Can You Really Learn Salesforce Marketing Cloud in 30 Days?
If you’re serious about taking your marketing career to the next level, mastering Salesforce Marketing Cloud could be a game-changer. But with so many features,…
What is Salesforce Managed Services? Why Business Using Salesforce CRM Needs Salesforce Managed Services?
Salesforce is the global leader in the CRM industry for more than a decade. Salesforce is the world's first online & real-time CRM. It allows…
Popular Salesforce Videos
How to Use Dispatcher Console in Salesforce Field Service? | Elevate Field Service Delivery | AblyPro
Dispatcher Console makes field service delivery easy for your business. Using the Dispatcher Console included in the Field Service package, your dispatchers can easily schedule,…
Top 3 Interview Tips | How To Land A Salesforce Job
In this video, brad discusses the TOP 3 ways to nail your interview and land a job as a Salesforce Professional. These tips apply to…
The Story of Salesforce. How Marc Benioff Built The Best CRM
This video, How It Happened explains the story of how Salesforce went from a small startup in San Francisco to become the leading CRM provider.…