-
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
DataLoader in Salesforce - An Introduction
Information Loader is a customer application for the mass import or fare of information. Use it to embed, update, erase, or send out Salesforce records. …
10 Ways to Enhance Your Buyer Experience with Quote-to-Cash Solutions | Salesforce Guide
When you have hundreds or thousands of leads to respond to in a single day, errors happen and you get overwhelmed. Right from sending the…
Popular Salesforce Videos
Demo - Increase Your Sales Effectiveness With Sales Enablement and eSigning Inside Salesforce
In this video you will learn how to increase your sales effectiveness by creating, sending, tracking and engaging your potential customer, right inside Salesforce, through…
MuleSoft Integration: GoToWebinar to Salesforce - Learn Salesforce Series
In this video, you will learn how to use MuleSoft integration platform to transfer attendees data from GoToWebinar to Salesforce- 1. Set up GoToWebinar account,…
Salesforce Platform Quick Tip: How to Make Key Information Easier to Find
Want to flag things on a Salesforce record, so that your users notice? Like flagging a super important customer record, or alerting them that a…