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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

One field, two lookup targets to show conditionally

(2) ShareShare
ReportReport
Posted on by 8
Within real time forms for Dynamics:

For Postgraduate students we have two points of entry for the academic year 2025: September 2025 and January 2026
 
For undergraduate students, in September 2025 we would take off 2025 as an option for academic year.

However, we want to maintain the option for postgraduate.

We therefore need two sets of data list dropdown options in September 2025:
UG – 2026, 2027, 2028
PG – 2025, 2026, 2027
 
Academic year is one lookup field for both UG and PG

Is there a way of using the same field on the form for but just changing the view of the lookup targets (that are selected on the left - sreenshot attached)
 
Screenshot 2025-1...

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

Categories:
I have the same question (0)
  • Suggested answer
    Tom_Gioielli Profile Picture
    3,084 Super User 2026 Season 1 on at
    You have a few ways you can do this;
    ---------------------------------------------------------------------------
    Option 1: Standard Lookup field filtering
    • If your academic sessions are linked to Graduate or Post-Graduate, then you can use the standard lookup field filtering to limit the available options for sessions. This would mean your sessions would look like the following:
    Academic Level Configuration Table
    Record Name
    Undergraduate
    Post-Graduate
     
     
    Sessions Configuration Table
    Record Name Academic Level (Lookup) Academic Year
    September 2025 Undergraduate 2025-2026
    September 2025 Post-Graduate 2025-2026
    January 2026 Undergraduate 2025-2026
    January 2026 Post-Graduate 2025-2026
    September 2026 Undergraduate 2026-2027
    September 2026 Post-Graduate 2026-2027
    January 2027 Undergraduate 2026-2027
    January 2027 Post-Graduate 2026-2027
     
     
    ---------------------------------------------------------------------------
     
    If you do not have multiple configuration tables like above (one for the Academic Level and another with sessions per Academic Level), then you can still achieve this with some JavaScript. This will be a script that is run on load or change to the Academic Level and which adds a filer to the session lookup field. I would recommend creating system views on the sessions that filter available sessions per level that you can use as a filter.
     
     
    ---------------------------------------------------------------------------
     
    Overall this isn't too big of a lift, but how you go about it really varies based on your table structure and other configurations.
  • Verified answer
    ManoVerse Profile Picture
    884 Super User 2026 Season 1 on at
    You can use conditional lookup filter , Keep Academic Year as a single lookup field.
    Create two custom views on the Academic Year table:
    • UG View → 2026, 2027, 2028
    • PG View → 2025, 2026, 2027
    Apply JavaScript on the form to dynamically switch the lookup view based on the student type (UG or PG).
  • Verified answer
    Inogic Profile Picture
    748 on at
    Hi,
     
    Since you want to filter the Academic Year lookup field differently for both Undergraduate (UG) and Postgraduate (PG) students, here are some approaches to achieve this:
    1. Use addCustomFilter on the Lookup Field
    You can use JavaScript on the form to dynamically filter the lookup results based on the student type.
    Example:            obj.addPreSearch(function () {
                                   obj.addCustomFilter(getFilterXML(), "lookup_field_name");
                                  });
    In the getFilterXML() function, return the required FetchXML filter logic according to your conditions.
    1. Use Separate Lookup Views and Switch Views
    Create two separate views — one for UG and one for PG — and use JavaScript to dynamically switch between them.
    Example:   formContext.getControl("lookup_field_name").setDefaultView("viewid");
    This method allows you to display relevant lookup records based on the selected student type.
    Hope this helps!
     
    Thanks!
    Inogic

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 156

#2
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans