title: how to insert and update record through trigger in a custom object in salesforce
body: <p>Hi I have tried the below code </p>
  
  <pre><code>trigger CreateRecord on Account (before insert,before update) {
   List&lt;Account&gt; CreateAcc = new List&lt;Account&gt;();
      For(Account acc:trigger.new)
        {
         acc.Name='abc';
         CreateAcc.add(acc);
        }
      insert CreateAcc;  
   }
  </code></pre>
  
  <p>but the above code is creating the following error :
  Review all error messages below to correct your data.
  Apex trigger CreateRecord caused an unexpected exception, contact your administrator: CreateRecord: execution of BeforeInsert caused by: System.SObjectException: DML statement cannot operate on trigger.new or trigger.old: Trigger.CreateRecord: line 9, column 1<code>enter code here</code></p>
  
  <p>Please help me through the code as where I am wrong.</p>