I try to delete addresses of Customers. And I wrote a job. But I encounter this error :
"Cannot delete a record in LogisticsPostalAddress.
The corresponding AOS validation failed."
Can you help me to about this issue?
My job source code is :
static void B4D_DeleteAddresses(Args _args)
{
DirPartyPostalAddressView DirPartyPostalAddressView;
CustTable custTable;
str custTableNonDeleted;
LogisticsLocation location;
int i;
;
ttsBegin;
try{
while select custTable
{
while select DirPartyPostalAddressView
where DirPartyPostalAddressView.Party == custTable.Party
&& !DirPartyPostalAddressView.IsPrimary
{
location = LogisticsLocation::find(DirPartyPostalAddressView.Location,true);
if(location.validateDelete())
location.delete();
// i++;
}
}
}
catch(Exception::Error)
{
//custTableNonDeleted += custTable.AccountNum + "\n";
info("Caught 'Exception::Error'.");
}
ttsCommit;
// info(strFmt("Customer %1, deleted : %2 ", custTableNonDeleted, i));
}
*This post is locked for comments
I have the same question (0)