-
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
Custom CPQ Solution- Need of The Hour for Manufacturing Firms
Personalizing Salesforce CPQ to maximize ROI for Manufacturing Industries B2B customers are expecting the ease of use and intuitiveness of B2C shopping experiences. But the sales cycle…
Salesforce Community Cloud: Use Cases
Community Cloud, as the name suggests, is a Salesforce platform that gives companies the tools to create branded online communities. Through these communities, companies can…
Salesforce Trigger Example to count number of completed tasks in a single contact
Below is an example of how to use Salesforce Trigger to count number of completed tasks in a single contact trigger UpdateAccountNameFromContactLastName2 on Contact (before…
Popular Salesforce Videos
What is Salesforce Marketing Cloud?
Salesforce Marketing Cloud helps in digital marketing automation and analytics. In this video, we have provided detailed information about what is salesforce cloud and its…
How Much Time to Give to Salesforce Preparation?
Wondering how much time to give for Salesforce preparation? Watch this video it explains distinctly how much time you need to learn. If you have…
What is Headless Commerce in Salesforce Commerce Cloud?
With the advent of COVID, the buying journey of customers has changed significantly. As a result, brands need to keep up with this change and…