web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / getting data from othe...
Power Pages
Unanswered

getting data from other table using guid got from in power page

(0) ShareShare
ReportReport
Posted on by 14

Hi guys 

 

i have a form with a lookup. I want to autopopulate another field according to the value selected in lookup. i wrote a js to do this at onchange of the lookup field. i  was able to get the guid of the lookup field. but i couldnt data from the lookup field table using this guid. i tried using webapi but the result data comes with the length zero. Below is my code:

 

$(document).ready(function() {
// Get the field that triggers the onchange event
var foodItemLookup = $("#md_fooditem");
var quantity = $("#md_quantity");
 

// Add an onchange event handler to the field
foodItemLookup.on("change", function() {
// Call the function to set the foodGuid of the other field
setfoodGuidToField();
});

quantity.on("change", function(event) {
// Call the function to set the foodGuid of the other field
setfoodGuidToField();
});

// Function to set the foodGuid of another field
function setfoodGuidToField() {
debugger;
// Get the foodGuid of foodItemLookup
var foodGuid = foodItemLookup[0].value;
var quantityOfFood = quantity.val();
if(foodGuid && quantityOfFood){
 
var data = function loadRecords() {
return appAjax('Loading...', {
type: "GET",
url: "hungryhubcustomerportal.powerappsportals.com/_api/md_foods("+ foodGuid +")?$select=md_price",
contentType: "application/json"
});
}
var fdprice = data.name;
var total = quantityOfFood * fdprice;
$("#md_price").val(total);
}
else{
$("#md_price").val("");
}
}
});
 
can anyone help me with this?
Categories:
I have the same question (0)

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 Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Valantis Profile Picture

Valantis 59

#2
11manish Profile Picture

11manish 51

#3
omkarsupreme Profile Picture

omkarsupreme 27

Last 30 days Overall leaderboard