Update the custom field in table during import in data management

 Today we have a requirement to update the target table when record insert through data entity. so for that we have created a extension that helps us to do this customization

========================================================================

/// <summary>

/// UpdateEntitydatesource method help where there is any update opertaion on the inventable it will update the value.

/// </summary>

/// <returns>The collection.</returns>

[ExtensionOf(tableStr(EcoResReleasedProductV2Entity))]

final class AVAEcoResReleasedProductV2Entity_Extension

{

    public boolean updateEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)

    {

        boolean ignoreDataSource;

        

        switch (_dataSourceCtx.name())

        {

            case dataEntityDataSourceStr(EcoResReleasedProductV2Entity, InventTable):

            if( _entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Update)

            {

                InventTable bufferUpdate = _dataSourceCtx.getBuffer();


                bufferUpdate.AVAPartsSalesAnalyst = HcmWorker::findByPersonnelNumber(this.AVAPartsSalesAnalyst).RecId;

                bufferUpdate.AVASQATech           = HcmWorker::findByPersonnelNumber(this.AVASQATech).RecId;

                bufferUpdate.AVACategoryManager   = HcmWorker::findByPersonnelNumber(this.AVACategoryManager).RecId;

            }

            break;

        }


        ignoreDataSource = next updateEntityDataSource(_entityCtx, _dataSourceCtx);


        return ignoreDataSource;

    }


}


===========================================================================

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++