- Considering ‘Item Ledger Entries’ as posted transaction table which is non-editable and in case you need to update any record in there then what we can do.
- Creation of the records happen when we post a Sales Order, Purchase Order or Item Journal Lines.
It is a record created after we post these documents.
- By default, Business Central won’t provide us the permission to alter these posted records.
- But what if anyone wants to modify these records?
- let’s see how it can be done through this blog
Creating a new Table and Page
- First, I created a new table and page with the name “Lot No Info” which contains all the fields I wanted to edit in ILE
- I also added ‘Entry No,’ for this new table and page and made this as a “PK“
- And I wrote a procedure and called that procedure on “OnOpenPage()” trigger of our new page, so whenever this page opens, it should copy all the field details from the ILE to this new page.
- In the above-mentioned procedure, I validated all the fields which I wanted to modify in the ILE.
- So, once I open the page, all the records from the ILE will be copied to our new page. But I wanted all the records of Entry Type – Purchase and Positive Adjustment. That’s why I’ve applied the filter in my code.
- Since I’ve validated the ‘Entry No.’ field, the ‘Entry No.’ field from ILE will be copied to our new page along with all other fields.
- So once all the records are available in our new page, we can modify the field values.
- So, the first half work is done. The next part would be updating the changes what we have made in our new page to the ILE.
- But simply we cannot modify the base table. For that, first we have to provide permission to the base table ‘Item Ledger Entry’ to Read, Modify, Insert, Delete
- After assigning the permission, I’ve created a procedure to copy the records from the new page ‘Lot No Info’ to the ‘Item Ledger Entries’ which is based on the PK ‘Entry No.’
- And this procedure is called under an action in the newly created page ‘Lot No Info’.
- So, when the new page is opened, all the records from the ILE will be copied to our new page. And we modify the some of the records and click on that action.
- After clicking on the action, if we go and check the ILE, we can see the modified records.
- But remember, all the changes are done based on the PK ‘Entry No.’
For more details kindly visit our linkedin page:
or you can write us on firstname.lastname@example.org
By Vinyas. S.