Call table modified filed on data entity
Today we have a requirement when we are goinf to import using DMF to call the table modfiled modified method on the data entity so below is the example of the standard entity
[ExtensionOf(dataentityviewstr(EntAssetMaintenanceWorkOrderLineEntity))]
Final class IHSEntAssetMaintenanceWorkOrderLineEntity_Extension
{
public boolean insertEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
{
if (_dataSourceCtx.name() == dataEntityDataSourceStr(EntAssetMaintenanceWorkOrderLineEntity, EntAssetWorkOrderLine))
{
EntAssetWorkOrderLine workorderline = _dataSourceCtx.getBuffer();
this.ihsInitWorkOrderLine(workorderline);
}
boolean ret = next insertEntityDataSource(_entityCtx, _dataSourceCtx);
return ret;
}
/// <summary>
/// Updates data entity for data source.
/// </summary>
/// <param name = "_entityCtx">The data entity runtime context.</param>
/// <param name = "_dataSourceCtx">The data entity data source runtime context.</param>
public boolean updateEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
{
if (_dataSourceCtx.name() == dataEntityDataSourceStr(EntAssetMaintenanceWorkOrderLineEntity, EntAssetWorkOrderLine))
{
EntAssetWorkOrderLine workorderline = _dataSourceCtx.getBuffer();
this.ihsInitWorkOrderLine(workorderline);
}
boolean ret = next updateEntityDataSource(_entityCtx, _dataSourceCtx);
return ret;
}
private void ihsInitWorkOrderLine(EntAssetWorkOrderLine workorderLine)
{
if (this.isFieldModified(fieldNum(EntAssetMaintenanceWorkOrderLineEntity, MaintenanceAssetId)))
{
workorderLine.ihsInitFromWorkOrderObject();
workorderLine.ihsUpdateNetValue(EntAssetObjectTable::find(this.MaintenanceAssetId).RecId);
}
if (this.isFieldModified(fieldNum(EntAssetMaintenanceWorkOrderLineEntity, IHSAssetCondition)))
{
workorderLine.ihsUpdateAssetLifeCycleState();
}
}
}
Comments
Post a Comment