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

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / How to update the valu...
Finance forum

How to update the value in Entity Staging Table from Source Excel

(0) ShareShare
ReportReport
Posted on by 2,546

D365-Data Entity How to update the value in Entity Staging Table from Source Excel

i have 2 fields in excel source . now i want to update the value (Field1 + '-' + Field2) in staging table.

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at
    RE: How to update the value in Entity Staging Table from Source Excel

           DataEntityContextEventArgs entityContextEventArgs = _eventArgs as DataEntityContextEventArgs;

           DataEntityRuntimeContext entityCtx = entityContextEventArgs.parmEntityContext();

           DataEntityDataSourceRuntimeContext dataSourceCtx = entityContextEventArgs.parmEntityDataSourceContext();

  • Piyush Adhikari Profile Picture
    2,546 on at
    RE: How to update the value in Entity Staging Table from Source Excel

    i am customising base entity...LedgerJournalEntity

  • Mea_ Profile Picture
    60,284 on at
    RE: How to update the value in Entity Staging Table from Source Excel

    Why do you need new class?

  • Piyush Adhikari Profile Picture
    2,546 on at
    RE: How to update the value in Entity Staging Table from Source Excel

    Sir,

    i have created a new class and using event onMappingEntityToDataSource

    class AcxLedgerJournalEntity

    {

       /// <summary>

       ///

       /// </summary>

       /// <param name="_sender"></param>

       /// <param name="_eventArgs"></param>

       [DataEventHandler(tableStr(LedgerJournalEntity), DataEventType::MappingEntityToDataSource)]

       public static void LedgerJournalEntity_onMappingEntityToDataSource(Common _sender, DataEventArgs _eventArgs)

       {

       }

    }

    but how can i get the instance or objects of DataEntityRuntimeContext entityCtx, DataEntityDataSourceRuntimeContext dataSourceCtx.

    public void mapEntityToDataSource(DataEntityRuntimeContext entityCtx, DataEntityDataSourceRuntimeContext dataSourceCtx)

       {

           if (entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Insert

               || entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Update)

           {

               // When editing through the entity, always delay tax calculation to avoid

               // a O(n^2) tax calculation while importing multiple lines. The journal will

               // automatically calculate taxes later at posting time or when necessary.

               this.DelayTaxCalculation = NoYes::Yes;

               switch (dataSourceCtx.name())

               {

                   case dataEntityDataSourceStr(LedgerJournalEntity, LedgerJournalTable):

                       dataSourceCtx.setBuffer(LedgerJournalEntityBase::findOrCreateLedgerJournalHeader(this));

                       break;

               }

               super(entityCtx, dataSourceCtx);

           }

       }

  • Mea_ Profile Picture
    60,284 on at
    RE: How to update the value in Entity Staging Table from Source Excel

    You can do it in validateWrite or in the same mapEntityToDataSource method

  • Jie G Profile Picture
    on at
    RE: How to update the value in Entity Staging Table from Source Excel

    And you can also extend the data entity and add an unmapped field to the data entity. You can choose to use computed field or Virtual field according to your need.

    Please refer the following link for more details:

    docs.microsoft.com/.../data-entity-computed-columns-virtual-fields

  • Piyush Adhikari Profile Picture
    2,546 on at
    RE: How to update the value in Entity Staging Table from Source Excel

    Ok i also want to validate those field values too... how can i do this?

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: D365-Data Entity How to update the value in Entity Staging Table from Source Excel

    Hi Piyush Adhikari,

    You cannot update any values in the staging table, SSIS copies data from file to staging without any transformation, however, you can add code to mapEntityToDataSource() to set value in target table from 2 fields in the data entity. You can find lots of examples in AOT, just look at code in mapEntityToDataSource methods in standard entities.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans