// Create a new Job
static void JobCreateCustomer (Args _args)
{
CustTable custTable;
NumberSeq numberSeq;
Name name =’Teera Estate’;
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(),true);
// numberSeq.used();
custTable.AccountNum = numberSeq.num();
custTable.CustGroup =’30’;
custTable.Currency =’USD’;
custTable.PaymTermId =’Net45′;
custTable.PaymMode =’CHECK’;
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 end of transaction.
ttsCommit;
}
catch(Exception::Error)
{
throw Exception::Error;
}
}