You need to sign in to do that
Don't have an account?
Prince_sfdc
Error while writing a trigger on Account
Initial term of field expression
must be a concrete SObject: List<Contact> at line 12 column 6.
must be a concrete SObject: List<Contact> at line 12 column 6.
trigger CreateContact on Account (After Insert) { //Collection of contacts for saving new contacts. List<Contact> conList =new List<Contact>(); for(Account acc: trigger.new) { // For each Account create a new Contact. List<Contact> freshCon=new List<Contact>(); freshcon.Accountid=acc.id; freshcon.LastName=acc.Name +'_'+ acc.CustomerPriority__c; //add new Contact to the collection. conList.add(freshcon); } insert conList; }
I think this is a copy-paste issue. Look at line 10. You are creating a list of Contacts call freshCon and then used it like it was a single item.
Just replace the list for a single record. Like this:
Hope this help.