I might go even a tad further - create the AxCustTable class, then set the parmXXXX methods. This way it will call the business methods associated with the adding or changing of a customer. Just be sure not to access the AxCustTable.custTable() until after you do the initial save - otherwise it may decide to skip the business methods. If you have custom fields on the CustTable, you'll want to add parm methods to match on the AxCustTable class. You can either add them manually, or I think there is a way to regen the AxCustTable class - but you'd have to research it.
--- On Sun, 11/30/08, Willem Botha <[EMAIL PROTECTED]> wrote: From: Willem Botha <[EMAIL PROTECTED]> Subject: RE: [development-axapta] Re: Creating customers programmatically To: development-axapta@yahoogroups.com Date: Sunday, November 30, 2008, 3:01 AM Look at the class called AxCustTable it has everything you need to create the customers already. it is used in the EP class ____________ _________ _________ __ From: development- [EMAIL PROTECTED] ps.com on behalf of mrkaarel Sent: Fri 2008/11/28 03:52 PM To: development- [EMAIL PROTECTED] ps.com Subject: [development- axapta] Re: Creating customers programmatically Okay, here's what I came up with (looks like it wasn't so difficult as I feared). Please, can someone with a little bit more experience tell me, if there's anything I should change in this hacked up code; something's that really prone to break. Thanks again. --- NumberSeq numberSeq; CustTable custTable; ; ttsbegin; numberSeq = NumberSeq::newGetNu m(CustParameters ::numRefCustAcco unt(), true); custTable = CustTable::find( CustParameters: :find().defaultC ust); custTable.AccountNu m = numberSeq.num( ); custTable.initValue (); custTable.Name = "Test 2"; custTable.CustGroup = "ERA"; custTable.Country = "EE"; custTable.setPaymen tReference( ); //specific address not needed right now custTable.Address = Address::FormatAddr ess("", "", "", "EE", "", ""); custTable.insert( ); numberSeq.used( ); ttscommit; --- [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]