-
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
Here's How Salesforce Promotes Collaboration through Interoperability
With problems like COVID-19 ransacking the world, have you ever wondered how governments had worked closely with other governments on a national and local level…
FlexDeploy Loves Salesforce: Build and Deploy Salesforce DX Apps
FlexDeploy is an Enterprise DevOps platform with fully integrated support for Salesforce apps, metadata customizations, integrations and more. This is the fourth article in a blog…
Salesforce Nonprofit Cloud Spring '24 Highlights
While many of us are still feeling the chill of winter, Salesforce's Spring '24 release is in full bloom! Let's review some of the Nonprofit…
Popular Salesforce Videos
Salesforce Care Response Solution Demo
The Salesforce Care Response Solution is available at no cost to any emergency response teams, care management teams, health systems, health insurers, and other healthcare…
Displaying Field Values with Visualforce | Salesforce Video Tutorial
In this video, Rakesh Soni shows us how to display Field Values with Visualforce. This is a great video for anyone who wants to learn…
What is a Salesforce Admin?
Salesforce administrators are the gatekeepers of their employer's sales and marketing data. They create each user account and determine the proper level of access based…