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

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
I have the same question (0)
  • Dineshkarlekar Profile Picture
    1,836 on at
    to apply range on lookup based on form field value
    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
    236,503 Most Valuable Professional on at
    to apply range on lookup based on form field value
    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
    to apply range on lookup based on form field value
    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

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 1,882

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 525 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans