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 :

Method to extend standard data entity to map data source field when importing data into Dynamics 365 finance and operations

Jayaprakash Reddy Profile Picture Jayaprakash Reddy 270

Scenario:- We need to update Bank statement entity data source field based on input value when we are importing the data into Dynamics 365 finance and operations.

Resolution: -
 
We need to write chain of commands/event handler for insertEntityDataSource entity method to achieve the same and logic should be written in pre event handler/ before next keyword.
Please find below sample code for your reference. 
[ExtensionOf(dataentityviewstr(BankStatementEntity))]
final class BankStatementEntity_Extension
{
    public boolean insertEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
    {
        BankStmtISOAccountStatement bankStatement;
        boolean ret;
        
        if (_dataSourceCtx.name() == dataentitydatasourcestr(BankStatementEntity, BankStmtISOAccountStatement))
        {
            if (this.ToDateTime == utcDateTimeNull())
            {
                throw error("To date must be specified");
            }
            bankStatement = _dataSourceCtx.getBuffer() as BankStmtISOAccountStatement;
            bankStatement.AccountingDate = DateTimeUtil::date(this.ToDateTime);  
            _dataSourceCtx.setBuffer(bankStatement);
        }

        ret = next insertEntityDataSource( _entityCtx,  _dataSourceCtx);
     
        return ret;
   
    }

}

Comments

*This post is locked for comments