-
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 Demand tool: Data Quality & Data Cleaning
Hi all, As you all know about the Demand tool which is used for Salesforce data cleaning and maintaining its quality. In this article, you…
An Introduction to Salesforce Enterprise Social Network
Billions of people use social networking platforms to stay connected with their family, friend, and business associates. Now, entrepreneurs need a customized corporate networking podium…
Can Salesforce help with Project Management?
“As you navigate through the rest of your life, be open to collaboration. "Other people's ideas are usually better than your own." Quote by Amy…
Popular Salesforce Videos
Salesforce Training for Beginners | Salesforce Tutorial for Certification
Once upon a time, storage was a big problem, but the innovations in technology have solved this. We can say that Cloud computing is one…
Create a New Marker Layer in Maps | Salesforce Maps
Salesforce Maps is a location intelligence and map visualization tool that integrates with your Salesforce CRM, simplifying territory management. With Salesforce Maps you can create territories…
How to write your first Apex program? | Salesforce Apex basics
In this video, we have explained that how you can write your first apex program in Salesforce. We used developer console to write the code.…