Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Want to show some values on a lookup based on a field in another form in x++

(0) ShareShare
ReportReport
Posted on by 3

In Finance and Operations, I have a field named ScaleID that has been created in the form level in Form1. This field has two methods associated with it. One is jumpref which is responsible for navigating to another form. Another method is edit, this is triggered when this is field switched to edit mode. Most importantly, this field has a lookup which gets value from another form named Form2. In the Form2, I have another field named status included to every record in that form, says that the particular record is active or not. My problem is if the record is active (status to yes) in the Form2, then only that particular record should be displayed in the lookup of the field ScaleID in Form1. If it is not active ( status to no ), then the record should not display in the lookup.

I am expecting the lookup should show only the active records (status to yes) on the lookup of the Form1.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Want to show some values on a lookup based on a field in another form in x++
    Hi,
     
    Forgot about the form - Lookup will be built based on the table only.
    So form1 and form2 will have separate DataSource which is related to tables.
    So built the look based on the table present on the form 2 DataSource and add active field range to it.
    You can refer to below blog.
     
    Thanks,
    Girish S.
     
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    Want to show some values on a lookup based on a field in another form in x++
    If I understand correctly, your problem is to show only active records of form2 when you click on the lookup on ScaleID field on form1.
    Then you can write the code in lookup of that control and give a query to retrieve the active records.
     
    The below link is for your reference.
  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    Want to show some values on a lookup based on a field in another form in x++
    I am assuming there is table relation in-place between table that have Status field and the table containing ScaleID field so you can join the tables in lookup method and add range. 
  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    Want to show some values on a lookup based on a field in another form in x++
    Hi, How about adding range on Status to check if record is active in Scale Id field lookup. If there is no lookup method then you can override/extend the lookup method to write code.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,111 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,934 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans