I have a field InvoiceStatus on the Purchase Order list. The available options for this button are Open, Received, and Received & Invoiced. The default status is Open. However, when I generate all lines from GetReceiptLines and post the purchase invoice, all the lines from GetReceiptLines are included and posted. I want the status of the InvoiceStatus on the Purchase Order List to change to Received & Invoiced. How can I achieve this using AL?
Note: If any one line is left on purchase invoice, status should not change to received & Invoiced if final line is posted it should change.