Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

I want to override my itemId lookup and have only items that contain "a" alphabet.

Posted on by 51
I want to override my itemId lookup and have only items that contain /a/ alphabet in string of itemGroupId. please suggest any solution for this.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 7,269 User Group Leader on at
    I want to override my itemId lookup and have only items that contain "a" alphabet.
    Hi @Ahmed,
     
    You must override the lookup method and add this code
    Query                   query          = new Query();
    QueryBuildDataSource    queryBuildDataSource;
    SysTableLookup          sysTableLookup = sysTableLookup::newParameters(tableNum(InventTable), this);
    
    ;
    
    sysTableLookup.addLookupfield(fieldNum(InventTable, ItemId));
    sysTableLookup.addLookupfield(fieldNum(InventTable, itemGroupId));
    
    queryBuildDataSource = query.addDataSource(tableNum(InventTable));
    queryBuildDataSource.addRange(fieldNum(InventTable, itemGroupId))
    .value(SysQuery::valueLike('a'));
    
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
    Best regards,
    Mohamed Amine MAHMOUDI

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,914 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,549 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans