My code crashes on updating customer's record. Why it happens. When I remove the pricelist from the customer in Standard ERP manually (not in HAL) it does not crash. Any ideas why it crashes?
...
2019-07-19 16:26:01 AD delete pricelist AAA from PBESEAGR
2019-07-19 16:26:01 AD delete... pricelist from PBESEAGR
2019-07-19 16:26:01 AD CopyDVP with some KeyMasterArrType touchedf!=false
2019-07-19 16:26:01 AD
2019-07-19 16:26:01 AD dump of call stack
2019-07-19 16:26:01 AD Exiting to protect the database
Code:
ResetLoop(CUr);
CUr.Code=custcode;
if (ReadFirstMain(CUr,1, true)) then begin
RecordCopy(oldCUr, CUr);
end else begin
end;
if (action=="DEL") then begin
LogText(0, "delete pricelist "& CUr.PLCode & " from " & oldCUr.Code);
CUr.PLCode="";
LogText(0, "delete... pricelist from " & CUr.Code);
err=RecordUpdate(oldCUr, CUr,true);//crash here
if (err==0) then begin
...