Sage 100

 View Only
  • 1.  I have a script that creates AR Invoices (for comm

    Posted 09-18-2012 13:25
    I have a script that creates AR Invoices (for commission purposes) when SO Invoices are posted. I'm firing off from the SO_SalesOrderDetail table PreDelete event. I'm ensuring that the script does not fire off when a line is deleted in SO entry with ""if oSession.Updating<>0 then..."" My problem, when the script runs, it runs twice - once for each sales order line, then again. Does the SO Invoice posting process run two SO Detail delete events? If so, how can I differentiate them? BTW, I tried this on PostDelete event and got the same result. Thanks!


  • 2.  RE: I have a script that creates AR Invoices (for comm

    Posted 09-18-2012 14:46
    This answer from Elliott Pritchard worked: ""I suspect, as you have, that there are two different areas that the update is attempting to delete the order line. What you may want to try is to check for the oBusObj.EditState of the record and only do the logic when EditState = 1. I think the second time it ""tries"" to delete the line the editstate will be zero. The delete, just simply does that tries to delete the line, it will continue to do the Pre and Post events regardless of whether the line was actually deleted.