Hi, I haver this requirement:
I need to delete all sales orders that are more than 15 days old (it doesn´t matter if they were covered totally o partially). I wrote some code and it works perfect, BUT, this sales orders are not archived automatically and I need that they are archived.
dFechaInicio := 20220101D;
dFechaBorrar := CalcDate('<-15D>', WorkDate());
rcSalesHeader.SetRange("Order Date", dFechaInicio, dFechaBorrar);
if rcSalesHeader.FindSet() then
repeat
rcsalesLine.SetRange("Document No.", rcSalesHeader."No.");
if rcsalesLine.findset() then begin
rcsalesLine.DeleteAll();
rcSalesHeader.Delete();
end;
until rcSalesHeader.NEXT = 0;
end;
I've thingking that I need to use a different method to achive this because in fact what I want to replicate is as if user was hitting Delete button:
Finding those methods confuses me a lot.
Thanks in advance.