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;
}
}
Hope you find this helpful and will come up with another interesting blog, till then happy daxing....