[Event Request] Table 36/38 OnBeforeDeleteDocumentReservation
in table 36 and 38 a new eventtrigger is needed when deleting all lines from Header:
Table 36 Procedure DeleteSalesLines IF SalesLine.FINDSET THEN BEGIN OnBeforeDeleteDocumentReservation(VAR rec: SalesHeader,GetHideValidationDialog); -- new event ReservMgt.DeleteDocumentReservation(DATABASE::"Sales Line","Document Type","No.",GetHideValidationDialog); REPEAT
Table 38 Procedure DeletePurchaseLines IF PurchLine.FINDSET THEN BEGIN OnBeforeDeleteDocumentReservation(VAR rec : PurchaseHeader,GetHideValidationDialog); -- new event ReservMgt.DeleteDocumentReservation(DATABASE::"Purchase Line","Document Type","No.",HideValidationDialog); REPEAT
please add also tables 900 and 5740 table 900 Procedure DeleteAssemblyLines AssemblyLine.SETRANGE("Document Type","Document Type"); AssemblyLine.SETRANGE("Document No.","No."); IF AssemblyLine.FIND('-') THEN BEGIN OnBeforeDeleteDocumentReservation(VAR rec: AssemblyHeader, HideValidationDialog) -- new event ReservMgt.DeleteDocumentReservation(DATABASE::"Assembly Line","Document Type","No.",HideValidationDialog); REPEAT
table 5740 OnDelete-Trigger IF NOT WhseRequest.ISEMPTY THEN WhseRequest.DELETEALL(TRUE);
OnBeforeDeleteDocumentReservation(VAR rec: TransferHeader, HideValidationDialog); -- new event ReservMgt.DeleteDocumentReservation(DATABASE::"Transfer Line",0,"No.",HideValidationDialog);
it can be done as single event here - ReservMgt.DeleteDocumentReservation
In our solution we need to handle different tables depending on the origin record table. They are handled similar as reservatiuon entries - but Reservation entries may not exist.
In case of a global trigger in ReservMgt.DeleteDocumentReservation the records from the original call are not available any longer and the Reservation records are even not searched at the Moment the OnBefore is necessary.
Maybe a better handling at this point would be possible if ReservMgt.DeleteDocumentReservation would have been called with variant and using recordref instead of the actual interface DeleteDocumentReservation(TableID : Integer;DocType : Option;DocNo : Code[20];HideValidationDialog : Boolean)