trigger AccountTeam on Account (after insert) {
       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;


The following error is thrown:

DML requires SObject or SObject list type: AccountTeamMember

  • 5
    And your question is?
    – Girbot
    Jan 29, 2018 at 14:22
  • I am getting this error DML requires SObject or SObject list type: AccountTeamMember Jan 29, 2018 at 17:42

2 Answers 2


I am adding this as answer as I wanted to help you more than a comment would allow. Your question has been downvoted as it shows a lack of effort on your part and is not clear what you are asking. Please read how to ask a question. More information would be helpful here, is that the full error message? No line number or class mentioned?

Now trying to help you...

I tried your trigger as is (minus the field VPA__c) in a dev org and it worked fine. The difference may be due to Account access settings, mine is public read/write. This example adds the respective AccountShare at the same time while creating the AccountTeamMember. I do not know this for a fact, just a suggestion.

The bad news / constructive feedback

You need to read up on Apex Best Practices. Your trigger:

  1. Has SOQL in a for loop (Why? governor limits)
  2. Has DML in a for loop (Why? governor limits)
  3. Has logic in the trigger itself (Why? lots of reasons!)
  4. It's not bulkified

Below is an example of a better approach. It is deliberately not complete.


trigger exAccountTrigger on Account (before insert, after insert,before update, after update) {

        //Before Trigger methods here



Helper Class

public without Sharing class exAccountHelper {
    public static void createTeamMember(List<Account> newAccs){
        List<AccountTeamMember> accMemLsit = new List<AccountTeamMember>();
        //Create AccountTeamMember logic here
        //Left as an exercise for the reader

        insert accMemLsit;
  • Sir the error is on line 7,8,9,10 Variable does not exist: AccountId, Variable does not exist: UserId, Variable does not exist: TeamMemberRole , DML requires SObject or SObject list type: AccountTeamMember Jan 29, 2018 at 18:57
  • I didn't understand why this issue is coming DML requires SObject or SObject list type: AccountTeamMember Jan 30, 2018 at 5:50

Another reason this error may be thrown is that 'Account Teams' is not enabled in your Org. The standard object AccountTeamMember is not available unless Account Teams is enabled.

To enable account teams follow these instructions: Enable Account Teams

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .