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 111
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. 
 
  • Verified answer
    Viswanath M Profile Picture
    111 on at
    Data entity for bank statement attachments
    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);
        
     }
     
     
  • Viswanath M Profile Picture
    111 on at
    Data entity for bank statement attachments
    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.

  • Subhad365 Profile Picture
    19 User Group Leader on at
    Data entity for bank statement attachments
    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
    111 on at
    Data entity for bank statement attachments
    No, I didn't add those fields to the entity.

  • André Arnaud de Calavon Profile Picture
    293,245 Super User 2025 Season 1 on at
    Data entity for bank statement attachments
    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
    111 on at
    Data entity for bank statement attachments
    Yes,
  • Martin Dráb Profile Picture
    231,925 Most Valuable Professional on at
    Data entity for bank statement attachments
    There are quite a few things to check. For example, are you using Inner Join to join BankStmtISOAccountStatement?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,245 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,925 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans