Madeline - It is definitely a WAD but it's also true that it won't delete the PDF and PDF log entry if LastInvoiceOrderNo has something in it. Since you have some scripters in your company maybe they could try playing with this little number in the Table Pre-Delete event. I presume here that Retain Deleted Orders in History = Y (not Prompt, not No)
LastInvoiceOrderNo = """"
retVal = oBusObj.GetValue(""LastInvoiceOrderNo$"", LastInvoiceOrderNo)
If (oSession.Updating = 0 and oBusObj.EditState = 1 and LastInvoiceOrderNo = """") Then
retVal = oBusObj.SetValue(""LastInvoiceOrderNo$"", ""Temp"")
End If
It sets a value of ""Temp"" into the SO object for LastInvoiceOrderNo. When the Sage delete function runs it will now NOT delete the PDF and PDF log entry and best of all ""Temp"" is not actually written to the field (b/c we are in the middle of a Delete not a Write).
The only thing you may need to handle is if on the prompt for ""Do you wish to delete the order Yes / No "", if the user says No, then you may need another script for Table PreWrite (in case they save the order) that sets LastInvoiceOrderNo="""" if it is currently ""Temp