Update has been cancelled when posting On Account Project Creditnotes

In Microsoft Dynamics AX 2012 we recently came across a case whereupon posting of On account Project Creditnotes, this was not possible and the process was aborted with an errormessage:
 
 
“Update has been canceled because of an error, Posting has been canceled”
 
 
On closer inspection the error was caused by that the field ‘InvoiceRefRecID’ on the table ‘ProjInvoiceOnAccDetail’ contained an invalid reference. The ‘InvoiceRefRecID’ field has to contain the RecID value from the specific invoice which is stored in th table ‘ProjInvoiceOnAcc’ – The solution was thus to copy the RecID from ‘ProjInvoiceOnAcc’ (where the ProjInvoiceOnAcc RecID for the correct invoice was found on the ProjInvoiceJour form, tabpage ‘OnAccount’) to replace the content in the ‘InvoiceRefRecID’ field and the posting could go through.