Attachment Data Entity for Free Text Invoices

I have a requirement to post notes to Free Text Invoices in D365 F&O using Logic Apps. To accomplish this, I decided to create a Data Entity based on the SalesOrderHeaderDocumentAttchmentEntity which I have used to post notes to SalesOrders.

I created a copy of SalesOrderHeaderDocumentAttchmentEntity, replaced SalesTable with CustInvoiceTable and updated the relations. Replaced the field SalesOrderNumber with InvoiceId. Created a copy of the staging table SalesOrderHeaderDocumentAttachmentStaging and updated the field list. Created copies of the Security Privileges, Import, View, Maintain.

When I run the Logic App, I receive the following message. I’m not quite sure why the RefRecId is needed. It’s not for SalesOrderHeaderDocumentAttchmentEntity. How does the Document Attachment Entity work for Sales Orders and not Free Text Invoices or am I missing something in the entity config?

An error has occurred. Write failed for table row of type 'FreeTextInvoiceNotesEntity'. Infolog: Warning: Field 'Reference record ID' must be filled in.; Warning: validateWrite failed on data source 'DocuRefEntity (DocuRefEntity)'