// Create a new Job
static void JobCreateVendor(Args _args)
{
VendTable VendTable;
NumberSeq numberSeq;
Name name = 'Teera Estate';
DirParty dirParty;
DirPartyPostalAddressView dirPartyPostalAddressView;
DirPartyContactInfoView dirPartyContactInfo;
DirPartyTable dirPartyTable;;
/* Marks the beginning of a transaction.
Necessary to utilize the method numRefCustAccount() */
ttsBegin;
VendTable.initValue();
try {
//VendTable
numberSeq = NumberSeq::newGetNum(VendParameters::numRefVendAccount(), true);
// numberSeq.used();
VendTable.AccountNum = numberSeq.num();
VendTable.VendGroup = '30';
VendTable.Currency = 'USD';
VendTable.PaymTermId = 'Net45';
VendTable.PaymMode = 'CHECK';
VendTable.insert(); //DirPartyType::Organization, name);
dirPartyTable = DirPartyTable::findRec(VendTable.Party, true);
dirPartyTable.Name = 'Teera';
dirPartyTable.update();
//DirParty
/* Creates a new instance of the DirParty class from an address book entity
that is represented by the VendTable parameter. */
dirParty = DirParty::constructFromCommon(VendTable);
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;
dirParty.parmName('Teera');
// Fill Contacts
dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
// Marks the end of transaction.
ttsCommit;
}
catch(Exception::Error) {
//ttsAbort;
throw Exception::Error;
// throwException::Error;
}
}
Like this:
Like Loading...
Thanks you for posting
X++ code to create vendor account by selecting particular customer account through dialog box….
and if multiple address at customer side those same multiple addresses have to be copied vendor account using code