Hi Friends,
How can we create Customer for an single legal entity in ax 2012 through x++ coding .
Thanks& Regards,
padmapriya.v
*This post is locked for comments
Hi Sukrut,
I have used your Change company concept in the x++ code ,
static void JobCreateCustomer (Args _args)
{
custTable _custTable;
numberSeq _numberSeq;
name _name ='i82';
DirPartyTable dirPartyTable;
dirParty _dirParty;
dirPartyPostalAddressView _dirPartyPostalAddressView;
dirPartyContactInfoView _dirPartyContactInfo;
;
changecompany ("USSI")
_custTable.initValue();
_numberSeq = numberSeq::newGetNum(CustParameters::numRefCustAccount());
_custTable.AccountNum = "1234";//_numberSeq.num();
_custTable.CustGroup ='gh';
_custTable.Currency ='INR';
_custTable.PaymTermId ='89';
_custTable.PaymMode ='C12';
_custTable.insert();
_dirParty = dirParty::constructFromCommon(_custTable);
_dirPartyPostalAddressView.City ='ui';
_dirPartyPostalAddressView.Street ='oiut';
_dirPartyPostalAddressView.StreetNumber ='29';
_dirPartyPostalAddressView.CountryRegionId ='hd';
_dirPartyPostalAddressView.State ='DE';
_dirParty.createOrUpdatePostalAddress(_dirPartyPostalAddressView);
_dirPartyContactInfo.Locator ='shdgfjsd';
_dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;
_dirPartyContactInfo.IsPrimary = NoYes::Yes;
_dirParty.parmName('Meera');
// _dirPartydirParty.parmName('Teera')
_dirParty.createOrUpdateContactInfo(_dirPartyContactInfo);
dirPartyTable = DirPartyTable::findRec(_custTable.Party,true);
dirPartyTable.Name = 'Meera';
dirPartyTable.update();
//_dirPartyPostalAddressView.Location_name ='TT';
//_dirParty = dirParty::constructFromCommon(_custTable);
}
But ill getting error like "Cannot create a record in Customers (CustTable). Insert operations are not allowed across companies. Please use changecompany keyword to change the current company before inserting the record."
Please suggest me an solution.
Thanks & Regards,
padmapriya.v
Hi Sukrut ,
Thanks for your reply , But its not my question .
For example , if we are in legal entity: "THMF" and i need to create a customer and assign the customer for only these to Legal entity : "THMF" & "USSI" using x++ how do i create in it.
Thanks & regards,
padmapriya.v
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156