Search code examples
axaptax++dynamics-365-operations

Foreign key field in Child data source is not filling when the data source joined with Outer join link in D365 F&O


I have created a simple table SaleslineEx. which has a foreign key relationship with the SalesLine table.

SalesLineEx FK relation

SalesLineEx datsource with outer join

When trying to create a new record in the sales line, the SalesLineEx sales line field does not populate with the sales line record.

Empty value in salesline field

I have tried different solutions from the blogs but they are not working. Can anyone give me a solution?


Solution

  • I was able to resolve this issue by creating the mapping between my extension table and the SalesLineusing SysExtensionSerializerExtensionMap. Mapping node

    enter image description here

    After adding the mappings create an Extension class for the SalesLine table, and create a COC method for the insert method. Call the insert operation of the Extension table after the next call of the sales line insert method, using SysExtensionSerializerExtensionMap class from the extension table buffer is shown below.

    next insert(_dropInvent, _findMarkup, _childBuffer, _skipCreditLimitCheck, _skipWHSProcesses, _interCompanyInventTransId);
    
        if(FormDataUtil::isFormDataSource(this))
        {
            SalesLineExt salesLineExt = this.SysExtensionSerializerMap::getExtensionTable(tableNum(SalesLineExt));
            salesLineExt.SysExtensionSerializerExtensionMap::insertAfterBaseTable(this);
        }
    

    SalesLineExtesnionCalss

    COCForInsertMethod