web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Vendor batch number in on hand form

(0) ShareShare
ReportReport
Posted on by 618
Hi Experts,
 
I need to add the vendor batch number to the On-hand form in D365. I was able to add it using the code below, and it worked correctly for the first item I tested. However, after changing the display dimensions, I began receiving the error shown below. Could you please help me identify what went wrong?
 
 
[ExtensionOf(classStr(InventDimCtrl_Frm_OnHand))]
final class InventDimCtrl_Frm_OnHand_Extension
{   
    public void modifyQueryBasedOnDatasourceName(
        Query          _inventSum_DS_Query,
        str            _inventSum_DS_Name,
        FormDataSource _inventDim_DS)
    {
    
        next modifyQueryBasedOnDatasourceName(_inventSum_DS_Query,
                                                _inventSum_DS_Name,
                                                _inventDim_DS);
        InventDimParm inventDimParmGroupBy = InventDimParm::orParmsAll(dimParmLockedRightClick, dimParmVisibleGrid);
        if (inventDimParmGroupBy.InventBatchIdFlag)
        {
            if (!_inventSum_DS_Query.dataSourceTable(tableNum(InventBatch)))
            {
                _inventSum_DS_Query.dataSourceTable(tableNum(InventDim)).addDataSource(tableNum(InventBatch), 'PBFInventBatch');
            }
            
            _inventSum_DS_Query.dataSourceTable(tableNum(InventBatch)).relations(false);
            _inventSum_DS_Query.dataSourceTable(tableNum(InventBatch)).joinMode(JoinMode::OuterJoin);
            _inventSum_DS_Query.dataSourceTable(tableNum(InventBatch)).clearLinks();
            _inventSum_DS_Query.dataSourceTable(tableNum(InventBatch)).addLink(fieldNum(InventDim, inventBatchId), fieldNum(InventBatch, inventBatchId));
            _inventSum_DS_Query.dataSourceTable(tableNum(InventBatch)).addLink(fieldNum(InventSum, ItemId), fieldNum(InventBatch, itemId), tableStr(InventSum));
            _inventSum_DS_Query.dataSourceTable(tableNum(InventBatch)).addGroupByField(fieldNum(InventBatch, PdsVendBatchId));
        }
    }
}
 
 
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    237,370 Most Valuable Professional on at
    Vendor batch number in on hand form
    Please share the errors. Your screenshot shows just the beginning of two of five error messages.
     
    By the way, I see you add the data source if InventBatchIdFlag is enabled, but you don't disable the data source if InventBatchIdFlag becomes inactive.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 763 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 658 Super User 2025 Season 2

#3
CU05031448-0 Profile Picture

CU05031448-0 544

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans