TransWikia.com

Getting Error while updating Account Name on conatct Last Name through Trigger

Salesforce Asked by AM_SFDC on December 24, 2021

I am uisng trigger to create A Contact record once Account record is created contact will get created where Account name will be Last name of contact.

 trigger AcctContTrigger on Account (after insert)
{
   List<Contact> conList= new List<Contact>();
     for(Account a:Trigger.new) 
         {
           Contact c=new Contact();
           c.lastName=a.Name;
           conList.add(c);
         }
   insert conList;      
}

Getting Error :Error: Compile Error: Variable does not exist: Name at line 7 column 25”
So Name is standard account field then why system doesnt recognize still

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP