DirParty dirParty;
LogisticsPostalAddress logisticsPostalAddress;
DirPartyPostalAddressView partyPostalAddressView;
ttsBegin;
DirPartyPostalAddressView dirPartyPostalAddressView;
LogisticsAddressStreet street;
street = 'test';
dirParty = DirParty::constructFromCommon(custTable::find('test001'));
logisticsLocation.clear();
logisticsLocation.Description = 'Primary Business Address';
logisticsLocation.IsPostalAddress = true;
logisticsLocation.LocationId = 'LOC-1001';
logisticsLocation.insert();
logisticsPostalAddress = LogisticsPostalAddress::findByLocation(logisticsLocation.RecId, true);
if (!logisticsPostalAddress.RecId)
{
logisticsPostalAddress.clear();
}
logisticsPostalAddress.CountryRegionId = 'US';
logisticsPostalAddress.State = 'CA';
logisticsPostalAddress.County = 'Santa Clara';
logisticsPostalAddress.City = 'San Jose';
logisticsPostalAddress.ZipCode = '95112';
logisticsPostalAddress.DistrictName = 'Downtown';
logisticsPostalAddress.Street = '1234 Market Street';
logisticsPostalAddress.Location = logisticsLocation.RecId;
dirPartyPostalAddressView.initFromPostalAddress(logisticsPostalAddress);
dirPartyPostalAddressView.LocationName = 'Headquarters Address';
dirPartyPostalAddressView.Party = custTable.Party;
dirPartyPostalAddressView.IsPrimary = NoYes::Yes;
dirPartyPostalAddressView.ProArIsCreatedByIntegration = true;
container roles;
roles = [LogisticsLocationRole::findByName('Business').RecId];
partyPostalAddressView = DirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView, roles);
ttsCommit;