Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Data entity import fai...
Finance forum
Suggested answer

Data entity import failing

Posted on by 29
I've created a data entity that joins the CustVendPDCRegister and LedgerJournalTrans tables. My goal is to update records in the CustVendPDCRegister table without modifying the LedgerJournalTrans table. To avoid errors during the update, even though I'm not changing any fields in LedgerJournalTrans, I added code in the mapEntityToDataSource method to set SkipValidateWrite on LedgerJournalTrans. However, this has resulted in the update operation being skipped entirely for both tables. When I debugged, I noticed that the saveEntityToDataSource method is returning false, preventing the operation from proceeding to the CustVendPDCRegister data source. Can anyone help me identify what might be going wrong?
 
 
public class SCCustVendPDCRegisterEntityLedgerJournalTransEntity extends common
{
    /// <summary>
    ///
    /// </summary>
    /// <param name = "_entityCtx"></param>
    /// <param name = "_dataSourceCtx"></param>
    public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
    {
        if (_dataSourceCtx.name() == dataEntityDataSourceStr(SCCustVendPDCRegisterEntityLedgerJournalTransEntity, LedgerJournalTrans))
        {
            this.skipDataSourceValidateWrite(true);
            _dataSourceCtx.setDatabaseOperation(DataEntityDatabaseOperation::None);
        }
       
        super(_entityCtx, _dataSourceCtx);
    }
}
  • Suggested answer
    VaHiX Profile Picture
    VaHiX 424 on at
    Data entity import failing
    I'd consider an alternative method to update CustVendPDCRegister without affecting LedgerJournalTrans. For example, handle the update logic separately or use a different method to bypass the validation for LedgerJournalTrans.
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 227,971 Super User 2024 Season 2 on at
    Data entity import failing
    If you don't want to update LedgerJournalTrans, you should set this entity data source as read-only.

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Mohana Yadav!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,115 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,971 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans