web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Data entity for bank statement attachments

(4) ShareShare
ReportReport
Posted on by 128
Hi everyone,
 
I have created a custom entity to import document attachments for bank statements. However, when I try to import data using the Data Management Framework (DMF) or through a Power Automate flow, I receive the following error:"Field 'Reference record ID' must be filled in.; Warning: validateWrite failed on data source 'DocuRef (DocuRef)'."

I have referred to this Solved: Data entity for worker attachments - post and tried to skip data methods but still the issue persists. I also refer these inbuilt entities CustomerAttachmentsV2Entity, HcmWorkerAttachmentsEntity, SalesOrderHeaderDocumentAttachmentV2Entity and LedgerJournalAttachmentsEntity. 
 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at
    There are quite a few things to check. For example, are you using Inner Join to join BankStmtISOAccountStatement?
  • Viswanath M Profile Picture
    128 on at
    Yes,
  • André Arnaud de Calavon Profile Picture
    301,210 Super User 2025 Season 2 on at
    Hi Viswanath,
     
    Have you added the fields RefTableId, RefRecId, and RefCompanyId on the field list of the data entity? If so, try to remove them or set these fields as non-mandatory for the data entity and staging table.
  • Viswanath M Profile Picture
    128 on at
    No, I didn't add those fields to the entity.

  • Subhad365 Profile Picture
    21 User Group Leader on at
    Additionally you can take a look at the PURCHASEORDERHEADERDOCUMENTATTACHMENTENTITY - it makes a relation to PurchPurchaseorderHeaderV2Entity and doesn't have any refenrece to RefTableId, RefrecId or RefCompanyId. You too can follow a similar flow of the structure. 
    I called this entity from a flow, which succesfully attached the incoming file stream to the target PO:
     
    Regards,
    Subha
  • Viswanath M Profile Picture
    128 on at
    I have seen this entity which is similar to the SalesOrderHeaderDocumentAttachmentV2Entity. Both sale and purchase document entity don't have RefTableId, RefrecId or RefCompanyId entity fields but, had the relationship to these fields. I have also tired replicate this entity for bank statement, but it also throws the same error.

  • Verified answer
    Viswanath M Profile Picture
    128 on at
    The error is solved after skipping validation & set the table buffer on mapEntityToDataSource method in data entity.
     
     
     
     public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
     {
         BankStmtISOAccountStatement bankStmtISOAccountStatement;
         select firstonly * from bankStmtISOAccountStatement where bankStmtISOAccountStatement.Identification == this.Identification;
         if(_entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Insert && _dataSourceCtx.name() == tableStr(DocuRefEntity))
         {
             _dataSourceCtx.skipValidateWrite(true);
         }
        
         if (_dataSourceCtx.name() == dataEntityDataSourceStr(YS_BankStatementDocumentEntity, BankStmtISOAccountStatement))
         {
             _dataSourceCtx.setBuffer(bankStmtISOAccountStatement);
         }
         
         super(_entityCtx, _dataSourceCtx);
        
     }
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans