CustName name;
DirParty dirParty;
ttsbegin;
custTable.clear();
custTable.initValue();
custTable.AccountNum = 'CUST-001';
name = 'Contoso Retailer';
custTable.InvoiceAccount = 'CUST-INV-001';
custTable.CustGroup = 'CUSTGROUP1';
custTable.PartyCountry = 'US';
custTable.Currency = 'USD';
custTable.CustClassificationId = 'CLASS-001';
custTable.TaxGroup = 'TAXGRP01';
custTable.TaxWithholdCalculate_TH = NoYes::Yes;
custTable.TaxWithholdGroup_TH = 'WITHHOLD-GRP1';
custTable.PaymTermId = 'NET30';
custTable.PaymMode = 'BANK';
custTable.InclTax = NoYes::No;
custTable.CredManAccountStatusId = 'ACTIVE';
custTable.Blocked = CustVendorBlocked::No;
custTable.DefaultDimension = 878468543576;
if(custTable.validateWrite())
{
DirPartyTable dirPartyTable;
if (!custTable.Party)
{
// Create a Party entry for customer
dirPartyTable = DirPartyTable::createNew(DirPartyType::Organization, name);
custTable.Party = dirPartyTable.RecId;
}
custTable.insert();
dirParty = DirParty::constructFromCommon(custTable);
dirParty.parmLanguageId('US-EN');
if(dirParty)
{
dirParty.update();
}
}