How to insert a new record using jobs
how to relate the Tables and How to insert a record in multiple Tables using jobs…,
How to insert a new record using jobs
how to relate the Tables and How to insert a record in multiple Tables using jobs…,
What does that mean?
Have look at \Data Dictionary\Tables\smmBusRelTable\Methods\relation2Customer
Hi satheesh,
See this…
https://community.dynamics.com/ax/b/daxbeginners/archive/2013/11/11/how-to-create-customer-through-x
Pls give more details…
Hi Satheesh
static void JobCreateCustomer (Args _args)
{
CustTable custTable;
NumberSeq numberSeq;
Name name =‘SouthSide Street LTDA’;
DirParty dirParty;
DirPartyPostalAddressView dirPartyPostalAddressView;
DirPartyContactInfoView dirPartyContactInfo;
/* Marks the beginning of a transaction.
Necessary to utilize the method numRefCustAccount() */
ttsBegin;
custTable.initValue();
try
{
//CustTable
numberSeq = NumberSeq::newGetNum(CustParameters::numRefCustAccount());
custTable.AccountNum = numberSeq.num();
custTable.CustGroup =‘020’;
custTable.Currency =‘BRL’;
custTable.PaymTermId =‘10DD’;
custTable.PaymMode =‘CHEQUE-01’;
custTable.insert(DirPartyType::Organization, name);
//DirParty
/* Creates a new instance of the DirParty class from an address book entity
that is represented by the custTable parameter. */
dirParty = DirParty::constructFromCommon(custTable);
dirPartyPostalAddressView.LocationName ='HeadQuarters ';
dirPartyPostalAddressView.City =‘São Paulo’;
dirPartyPostalAddressView.Street =‘4th Avenue’;
dirPartyPostalAddressView.StreetNumber =‘18’;
dirPartyPostalAddressView.CountryRegionId =‘BRA’;
dirPartyPostalAddressView.State =‘SP’;
// Fill address
dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
dirPartyContactInfo.LocationName =‘SouthStreet Contact Phone’;
dirPartyContactInfo.Locator =‘551291165341’;
//dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;
dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;
dirPartyContactInfo.IsPrimary = NoYes::Yes;
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
// Marks the end of transaction.
ttsCommit;
}
catch(Exception::Error)
{
ttsAbort;
}
}
this code may be help for u…
address Details are not saved Error found in
this line → dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
ERROR → State was not found…,
how to I resolve it…,
Make sure the data had a ‘State’ defined that is valid in the supporting tables, or add the mapped value to the table