public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { InventTransferLine inventTransferLine; switch (_dataSourceCtx.name()) { case dataEntityDataSourceStr(FAMInventTransferOrderLineEntity, InventTransferLine): inventTransferLine = _dataSourceCtx.getBuffer(); if (_entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Insert) { InventTransferTable transferTable = InventTransferTable::find(this.TransferId); InventDim inventDim; inventTransferLine.initFromInventTransferTable(transferTable, true); if (this.InventInventoryDimensionEntityFieldsMapping::isAnyInventDimFieldSet()) { inventDim = inventTransferLine.inventDim(); this.InventInventoryDimensionEntityFieldsMapping::updateInventDim(inventDim); inventTransferLine.InventDimId = InventDim::findOrCreate(inventDim).inventDimId; } inventTransferLine.ItemId = this.ItemNumber; inventTransferLine.modifiedField(fieldNum(InventTransferLine, ItemId)); inventTransferLine.QtyTransfer = this.QtyTransfer; inventTransferLine.modifiedField(fieldNum(InventTransferLine, QtyTransfer)); inventTransferLine.QtyRemainReceive = inventTransferLine.QtyTransfer; inventTransferLine.QtyRemainShip = inventTransferLine.QtyTransfer; inventTransferLine.InventDimId = inventDim.inventDimId; inventTransferLine.LineNum = this.LineNumber; _dataSourceCtx.setBuffer(inventTransferLine); } break; } super(_entityCtx, _dataSourceCtx); switch (_dataSourceCtx.name()) { case dataEntityDataSourceStr(FAMInventTransferOrderLineEntity, InventDim): inventTransferLine = _entityCtx.getRuntimeContextByName(dataEntityDataSourceStr(FAMInventTransferOrderLineEntity, InventTransferLine)).getBuffer(); _dataSourceCtx.setBuffer(InventDim::find(inventTransferLine.InventDimId)); break; } }In the example above the field is inventTransferLine.TransferId it is not set explicitlyin the code of mapEntityToDataSource, but it is setting in the inventTransferLine.initFromInventTransferTable method.
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units and "buy me a coffee" link.
Join us.