title: Got edit error onmodified field Purchtable createorder x++
body: <p>Every time Im using this code I get a error "you cannot edit the record in the table Purchtable".
  I cant proceed the order with it. My task is to get the default address for each site.</p>
  
  <pre><code>[ExtensionOf(formdatasourcestr(PurchCreateOrder, PurchTable))]
  final class PurchCreateOrderGetDefAdress_Extension
  {
  [FormDataFieldEventHandler(formDataFieldStr(PurchCreateOrder, PurchTable, OrderAccount), FormDataFieldEventType::Modified)]
  public static void OrderAccount_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
  {
      Formdatasource                              purchtable_ds = sender.datasource();
      PurchTable                                  purchtable = purchtable_ds.cursor();
      InventSite                                  inv;
      InventLocation                              invent;
  
      str iid =  UserInfoSz::findDefaultSite(curUserId()).InventSiteId;
      purchtable.inventsiteid = iid;
      purchTable.setAddressFromInventSiteId(iid);
  
      select firstonly invent where invent.inventsiteid == iid &amp;&amp; invent.WMSLocationIdDefaultReceipt == "recv";
      if(invent.RecId !=0)
      {
          purchtable.inventlocationid = invent.InventLocationId;
      }
      else
      {
          select firstonly invent where invent.inventsiteid == iid;
          purchtable.inventlocationid = invent.InventLocationId;
      }
  }
  
  }
  </code></pre>