Hi all,
Does anyone know a fast way to delete by code all the contacts or addresses for a party in the global address book?
Thanks!
Hi all,
Does anyone know a fast way to delete by code all the contacts or addresses for a party in the global address book?
Thanks!
Ok, I have managed to delete the addresses for all the customer (leaving only the primary one). I needed to do that because I am importing some addresses and filled my test environtment with a lot of garbage addresses
DirPartyPostalAddressView DirPartyPostalAddressView;
CustTable custTable;
LogisticsLocation location;
;
ttsBegin
;
while select
custTable
{
info(
strFmt(“Customer %1”
, custTable.AccountNum));
while select
DirPartyPostalAddressView
where
DirPartyPostalAddressView.Party == custTable.Party
&& !DirPartyPostalAddressView.IsPrimary
{
location = LogisticsLocation::find(DirPartyPostalAddressView.Location,
true
);
if
(location.validateDelete())
location.delete();
}
}
ttsCommit
;
Ok, I have managed to delete the addresses for all the customer (leaving only the primary one). I needed to do that because I am importing some addresses and filled my test environtment with a lot of garbage addresses
DirPartyPostalAddressView DirPartyPostalAddressView;
CustTable custTable;
LogisticsLocation location;
;
ttsBegin
;
while select
custTable
{
info(
strFmt(“Customer %1”
, custTable.AccountNum));
while select
DirPartyPostalAddressView
where
DirPartyPostalAddressView.Party == custTable.Party
&& !DirPartyPostalAddressView.IsPrimary
{
location = LogisticsLocation::find(DirPartyPostalAddressView.Location,
true
);
if
(location.validateDelete())
location.delete();
}
}
ttsCommit
;