Skip to main content

Notifications

Announcements

No record found.

How-To: Delete Open Purchase Orders Partially Received & Invoiced

Ahmed Mohamed Rafik Profile Picture Ahmed Mohamed Rafik 3,049 User Group Leader

Hello all.

One of the case scenarios that one of the customers that i deal with need to delete purchase orders that are open from last years but they have been partially received and invoiced (NAV 2018).

It is easy to delete purchase orders one by one, but when it came to delete hundreds of Purchase Orders, you need a tool to delete all these orders with one click, so i tried to figure out a solution to make this function come true.

I came to this development solution as i already see in another blog post, and it is like the follow:

1- From the Development Environment, Go to Reports and Create new report.

2- Select Data Type = Data and Data Source = Purchase Header

11

3- Open the Properties of the report.

4- From DataItemTableView enter the following:

SORTING(Document Type,No.) ORDER(Ascending) WHERE(Status=FILTER(Open),Document Type=FILTER(Order))

22

This condition means that Document with Type order and with status Open

5- Place this Code in the C/AL Code:

Purchase Header – OnAfterGetRecord()
“Purchase Header”.SetHideValidationDialog(TRUE);
“Purchase Header”.DELETE(TRUE);

This code means to delete and hide the validation of the delete message on every purchase order, so you will not to delete it manually.

33

6- Run the report from the Development Environment and see the results.

 

 


This was originally posted here.

Comments

*This post is locked for comments