Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Data entity import failing

(1) ShareShare
ReportReport
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 3,604 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 230,371 Most Valuable Professional on at
    Data entity import failing
    If you don't want to update LedgerJournalTrans, you should set this entity data source as read-only.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans