-
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
9 Features That Make Salesforce Service Cloud the #1 Customer Service Solution
Salesforce Service Cloud – The Most Trusted Customer Service Platform Customer service holds the key to uplifting brand value in today’s fast-paced business world. As…
New and Comprehensive Salesforce Certification Course at JanBask Training
JanBask Training has announced the training and certification course in one of the topmost and market-leading CRM tool Salesforce. It is a well-known fact that…
Opportunity Line Item | Salesforce Developer Guide
An opportunity is a pending agreement with a monetary value attached to it. It denotes that if the Opportunity is closed successfully, the $ amount…
Popular Salesforce Videos
What is Headless Commerce? | Salesforce Commerce Cloud
Brands need to keep up with this change and require a certain level of agility and nimbleness. This is where Headless Commerce is a game…
Develop a Basic Slack App For Salesforce
Build Slack Apps integrated with Salesforce. Use Heroku to host Slack apps built using Slack Bolt Framework and get connected to Salesforce using Node.js library…
Time-based Workflow Rules In Salesforce | Salesforce Tutorial
Learn all about time-based workflow rules in Salesforce. This tutorial will cover the following points - 1. Create A Workflow Rule Learn how a workflow…