SetIsWMItemDeletionReqd(flag : Boolean) BEGIN IsWMItemDeletionReqd := flag; //IsWMItemDeletionReqd is a global boolean var. END
Form - OnDeleteRecord() : Boolean IF (Quantity <> 0) AND ItemExists("No.") THEN BEGIN COMMIT; IF NOT ReserveSalesLine.DeleteLineConfirm(Rec) THEN EXIT(FALSE); ReserveSalesLine.DeleteLine(Rec); END; // Execute WMERP code only if WM add-on is enabled IF NOT WMI.IsWMAddOnDisabled() THEN BEGIN // Restrict deletion of G/L Account type of WM Sales Lines directly IF (Type = Type::"G/L Account") AND (WMItemNo <> '') THEN BEGIN MESSAGE(TEXT002); EXIT(FALSE); END ELSE BEGIN // Set flag to mark deletion of WM Item along with current salesline SetIsWMItemDeletionReqd(TRUE); EXIT(TRUE); END; END;
OnDelete() BEGIN ............... IF IsWMItemDeletionReqd THEN BEGIN // Delete WM Item corr. to Sales Line of type Item only. IF (Rec.WMItemNo <> '') AND (Rec.Type = Rec.Type::Item) THEN WMI.DeleteItem(SalesHeader, Rec); //WMI is a codeunit END; END;
Answers
viewtopic.php?f=23&t=41868&hilit=variable+cleared
I have now worked out in below manner:
Added IsWMItemDeletionReqd global var. to WMI codeunit instead of SalesLine table
Moved the SetIsWMItemDeletionReqd() function from SalesLine table to WMI codeunit.
So now from the OnDeleteRecord() trigger of the Quote & Order subform, i make a call as and from the OnDelete() trigger of Salesline table, and from the DeleteItem() of the WMI codeunit,
The above works fine.
Regards,
Hemant
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)