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, ...
Answered

Modification in LookupItem Method in InventTable (ax 2012 r3)

(0) ShareShare
ReportReport
Posted on by 95

Why the modification is ok with salesline of sales order It Select from End Product Only
but no effect in purchline of purchase order

here is:

public client static void lookupItem(FormStringControl _ctrl)
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildDataSource qbdsJoin;
SysTableLookup sysTableLookup = sysTableLookup::newParameters( tableNum(InventTable), _ctrl);
QueryBuildRange qbr;
;

qbds= query.addDataSource( tableNum(InventTable));
qbdsJoin= qbds.addDataSource( tableNum(InventItemGroupItem));
qbdsJoin.relations( false);
qbdsJoin.fields().dynamic(NoYes::Yes);
qbdsJoin.addLink( fieldNum(InventTable, ItemId), fieldNum(InventItemGroupItem, ItemId));
qbdsJoin.joinMode(JoinMode::InnerJoin);
qbr=qbdsJoin.addRange(fieldNum(InventItemGroupItem,ItemGroupId));

// info(strFmt("hierarchyParent %1",_ctrl.hierarchyParent()));

qbr.value('EndProd');
qbr=qbdsJoin.addRange(fieldNum(InventItemGroupItem,ItemDataAreaId));
qbr.value(curext());

sysTableLookup.parmQuery(query);
sysTableLookup.addLookupfield( fieldNum(InventTable, ItemId),true);
sysTableLookup.addLookupfield( fieldNum(InventTable,NameAlias));
sysTableLookup.addLookupfield( fieldNum(InventTable,ItemType));
sysTableLookup.addLookupfield( fieldNum(InventTable,Product));
sysTableLookup.performFormLookup();
}

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Modification in LookupItem Method in InventTable (ax 2012 r3)

    You'll find the answer by looking at Forms - PurchTable - Data sources - PurchLine - ItemId - lookup, as I wrote.

  • amr abdelaziz Profile Picture
    95 on at
    RE: Modification in LookupItem Method in InventTable (ax 2012 r3)

    thanks Nikolaos Mäenpää

    but what method i can modify to constrain the selection of purchse items

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Modification in LookupItem Method in InventTable (ax 2012 r3)

    Hi,

    please check following code:

    - Forms - SalesTable - Data sources - SalesLine - ItemId - lookup

    - Forms - PurchTable - Data sources - PurchLine - ItemId - lookup

    You will notice that the lookup for purchase item id is not using InventTable::lookupItem.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,370

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 675 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans