// To create new customer through X++
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.IsPrimary = NoYes::Yes;
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
// Marks the beginning of a transaction.
ttsCommit;
}
catch(Exception::Error)
{
ttsAbort;
throwException::Error;
}
}
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.IsPrimary = NoYes::Yes;
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
// Marks the beginning of a transaction.
ttsCommit;
}
catch(Exception::Error)
{
ttsAbort;
throwException::Error;
}
}
No comments:
Post a Comment