Override the initValue method of the table and add the below code to increment value of LineNum field whenever new record is created. public void initValue() { YourTableName tableName; super(); select firstonly maxof(LineNum) from tableName; this.LineNum = tableName.LineNum + 1; }
Data entity methods in d365fo Data entity methods in d365fo. mapEntityToDataSource // This method is hitting while updating and inserting // we can assign datasource1 recid values to child data source. // public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { if (_entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Insert || _entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Update) { if (_dataSourceCtx.name() == dataEntityDataSourceStr(MyEntity, MyDataSource)) { TestCustomer testCustomer = _entityCtx.getRuntimeContextByName( dataEntityDataSourceStr(MyEntity, TestCustomer)).getBuffer(); this.CustomerRecid = testCustomer.recid; } } super(_entityCtx, _dataSourceCtx); } -------------------------------------------...
Comments
Post a Comment