I have write a coding that allow a user to post selected journal lines in transfer journal. The selected lines will be deleted after posting and hence I need to update the number of lines for the journal after deletion. However, it is not working as expected. I have wrote a coding to update it manually by assigning the new number of line value and calling the update method for that journal after deletion. No error encounter so far but the number of lines is not updated in the table. Does anyone know why? Is there any built in existing method can be used?
Updating the NumOfLines field after you deleted the records is good enough.
But, it would have been updated automatically, if you were deleting the lines “the correct way”.
That means, using the JournalTableData/JournalTransData classes.
If you take a look at JournalTransData.delete() method, you will notice this simple line there
This updated the field.
Update on the header is called at the end of processing all the journal lines.
For an example of how deleting of lines should be performed, you can take a look at JournalDeleteTrans class.
Thank you very much for your help. At last I managed to solve the problem although I have spent a lot of time in understanding the code and did all the testing.