Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

to apply range on lookup based on form field value

Posted on by 1,457
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
    Dineshkarlekar 1,457 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 
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 229,302 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
    Dineshkarlekar 1,457 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();
    
                }
            }
     

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,302 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans