-
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
A Complete Guide On How To Implement Salesforce For Better Results
Salesforce implementation is of key importance for any company, big or small, and no matter what their specific needs and preferences are. Being one of…
[Presentation] Salesforce Security – An Encryption Guide For The Paranoid
If you are using Salesforce, you would be having a lot of data stored in Salesforce objects. Some of it would be sensitive data, and…
Salesforce Marketing Cloud
What is Marketing Cloud? To manage the relationship between marketers and customers, we use Marketing Cloud. Salesforce Marketing Cloud is used to make a interaction…
Popular Salesforce Videos
Custom Login Page Using Mulesoft | Salesforce Tutorial
In this video, you will learn how to create a custom login page using Mulesoft. Watch and learn. If you have any doubts do let…
Salesforce Spring 22 Treasure Hunt for Flow | Migrate your Workflow Rules to Flows
Salesforce Spring 22 Treasure Hunt for Flow 0:00 Register for pre-release org 0:27 Flow Trigger Explorer 2:07 Auto-Layout and Freeform option as Picklist 3:00 Set…
Salesforce Winter '23 Release Highlights - Video
Cosy up by the fireplace with a nice blanket and a cup of hot cocoa; Salesforce's Winter '23 update is as cool as ice! With…