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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

to apply range on lookup based on form field value

(0) ShareShare
ReportReport
Posted on by 1,836
hi ,
 
I have made the lookup on data field on form line data source  now i want to set the range on that lookup so the lookup filter the value with invent location id in header or lines as the header and location id is unique key in form how can i get this done , please suggest me on this .
 
 
thanks,
Regards,
Dinesh
  • Dineshkarlekar Profile Picture
    1,836 on at
    below is my code ,please help me out on this .
     [DataField]
            class InvoiceId 
            {
                /// <summary>
                ///
                /// </summary>
                /// <param name = "_formControl"></param>
                /// <param name = "_filterStr"></param>
                public void lookup(FormControl _formControl, str _filterStr)
                {
                    //super(_formControl, _filterStr);
    
                    SysTableLookup      sysTableLookup  = SysTableLookup::newParameters(tableNum(CustInvoiceJour), _formControl);
    
                    Query query = new Query();
                    QueryBuildDataSource queryBuildDataSource;
                    QueryBuildRange queryBuildRange;
    
                    queryBuildDataSource = query.addDataSource(tableNum( CustInvoiceJour));
     
                    queryBuildRange = queryBuildDataSource.addRange(fieldNum(DTDMCHeader, inventLocationId));
                    queryBuildRange.value(queryValue(DTDMCHeader.inventLocationId));
    
                    // Add the lookup columns
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, InvoiceId));
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, SalesId));
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, InvoiceAccount));
                    sysTableLookup.addLookupfield(fieldNum(CustInvoiceJour, inventLocationId));
                 
                    // Run the lookup
                    sysTableLookup.performFormLookup();
    
                }
            }
     
  • Verified answer
    Martin Dráb Profile Picture
    240,815 Most Valuable Professional on at
    You forgot to describe your problem, but I see an obvious bug. You have a query for CustInvoiceJour table but you're trying to add a range for DTDMCHeader.InventLocationId. I guess you wanted CustInvoiceJour.InventLocationId (the fourth field in your lookup).
  • Dineshkarlekar Profile Picture
    1,836 on at
    hi ,
    Martin ,
    Thanks for reply ,
    I forgot to add query in syslookup , fixed the issue  now lookup working fine .
     
     
     
    thanks,
    Regards,
    Dinesh 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 475 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 399 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 374

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans