Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Answered

Retrieve Dataverse lookup column and non lookup column values

(0) ShareShare
ReportReport
Posted on by 41

Hi guys,

 

Here's my scenario.

 

We have a form with a lookup field which connects to a Dataverse table that has 3 columns, I need to figure out a way to obtain values from all 3 columns (not just the lookup column). The objective is to allow the user to select a shipment reference from the lookup (which is populated onto the lookup box labelled Target Job), and for 2 other values on the same row to be obtained and auto populated, onto two read only fields; labelled Consignee and Consignor (these can be text boxes or dropdowns). The below image shows the 3 columns and the values which we require from each row.

 

KMP_Uniserve_1-1713354940383.png

 

The first column is not a problem as this is the lookup (primary column), in our use case this column gives us a shipment reference number.

 

The challenge is with the next step, we need to also grab the consignee and consignor values which are in the 2nd and 3rd column respectively. As far as I am aware, the lookup will only point to the primary column, and there is no way to obtain values from any other column.

 

I have tried multiple ways with Jquery, but I have not found a way to achieve this, I am only able to duplicate the lookup column shipment reference number onto the consignee and consignor text boxes (as shown on the 2nd image below), there does not seem to be a way to obtain the consignee and consignor values associated to the lookup column shipment reference, and auto populate this to the consignee and consignor text boxes.

 

KMP_Uniserve_2-1713355000004.png

 

Is there a way I can use Jquery to achieve this? If this is not possible with Jquery, how would I accomplish this using FetchXml and liquid code?

 

I am relatively new to Power Pages, Jquery, FetchXml and Liquid code. I did attempt to use FetchXml combined with Liquid code, but I couldn't figure out the correct syntax for what I am trying to achieve.

 

The Jquery syntax which I am currently using (only duplicates shipment reference from lookup column) is listed below (part of the Dymanics 365 environment name has been replaced with 'xxxx':

 

$(document).ready(function(){
$('#xxxx_target').on('change', function() {

$('#xxxx_consigneeauto').val($('#xxxx_target_name').val());
$('#xxxx_consignor').val($('#xxxx_target_name').val());
})
});

 

Target is the lookup search element name, consigneeauto is the text field intended to be used to autopopulate the consignee value, consignor is the text field intended to be used to autopopulate the consignor value.

 

Any advice would be greatly appreciated, apologies for making this post long; I wanted to make the scenario clear.

 

Thank you.

Categories:
  • KM-14051302-0 Profile Picture
    41 on at
    Re: Retrieve Dataverse lookup column and non lookup column values

    Thank you both for your advice! 😉

     

    I decided to go with the Jquery Web API approach and this has resolved the issue.

  • Verified answer
    Fubar Profile Picture
    7,960 Super User 2025 Season 1 on at
    Re: Retrieve Dataverse lookup column and non lookup column values

    If the user only needs to see the values (after they have selected the Lookup value) you can use a Quick View Form (defined on the Lookup Table, and added to your main dataverse form).

    If the values need to be saved, if using the quick view then save them using a realtime Workflow on change of the Lookup. Alternatively in JavaScript/JQuery on change of the Lookup field call the Power Pages Web API to query the the Lookup table and then populate the values with the returned results (for this option there will be a short delay as the ajax call will take a second or two).

    https://learn.microsoft.com/en-us/power-apps/maker/model-driven-apps/create-edit-quick-view-forms

    if using the power pages webapi there are additional settings that are also required etc https://learn.microsoft.com/en-us/power-pages/configure/web-api-overview

  • Atmaram90 Profile Picture
    125 on at
    Re: Retrieve Dataverse lookup column and non lookup column values
    You can join both the tables in fetchxml and select columns from both the tables. Reference: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/fetchxml/join-tables?tabs=fetchxml If you think to use power page webapi you could use $expand (https://learn.microsoft.com/en-us/power-pages/configure/read-operations#retrieve-related-table-records-with-a-query ) If you try to show both the columns in list that can be done by adding fields(consignee , consignor) in the dataverse view which is out of the box feature. Reference: https://powerusers.microsoft.com/t5/Microsoft-Dataverse/Dataverse-View-how-to-add-column-for-related-table-entity/td-p/972540

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43