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)’


Is that field included in an index? Also, you could try using the http post instead of the create record connector - I’ve had better luck with that occasionally.

I’m not seeing an index on the Data Entity.

I will try the HTTP POST connector to see if I have better success.


You should expand “Keys” to review the entity key.

Keys node expanded along with several others.