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 / How to prepopulate val...
Power Pages
Unanswered

How to prepopulate value in the form of one entity based on other entitiy(not contact)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Experts,

I want to prepopulate the lookup value in the form of one entity based on the logged in user from another entity which is not contact.

How can I do that?

Any help is appreciated.

Thanks.

Categories:
I have the same question (0)
  • H V Profile Picture
    1,510 on at

    Hi @Anonymous 

    Please follow below steps for your requirement:

    Step1: You need to create entity list of your "another entity".
    - Enable OData feed

    Step2: Add below code in Javascript section of entity form
    - Call oData query as per your requirement in the code

     

    $(document).ready(function(){
     //Call your oData query
     var odataUrl = location.origin + "/_odata/anotherentities/?$filter=new_contactid/Id eq (guid'7e7bb7f3-888b-ea11-a811-000d3a300e5b')";
     $.ajax({
    	type: "GET",
    	url: odataUrl,
    	dataType: 'json'
     }).done(function (data) {	
    	console.log(data);
     //get All value from oData query and pass value 
     $("#customerid_name").attr("value","Account Name");
     $("#customerid").attr("value","b27183ce-a8af-ea11-a812-000d3a579cb3");
     $("#customer_entityname").attr("value","account"); 
     });
    });

     

     

     

     

     

  • Christian Leverenz Profile Picture
    1,214 on at

    @hardikv : brilliant idea with the odata. Usually, i use it for lists and if i want a single entity, i use the entities tag in a specialized webtemplate.

    But your solution is definitely much simpler. Top - thanks for sharing

    Christian

  • OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi All,

     

    Want to point out one thing - you need to be careful when using ODATA feed with entity list as their endpoint is not secured and can be accessed anonymously. Don't expose any entity that shouldn't be visible anonymously. 

     

    I much prefer using webpages with fetchxml web template to retrieve necessary data as we can hide those pages under portal security roles and permissions. Check out this post from Colin Vermander explaining how to do it.

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 55

#2
DP_Prabh Profile Picture

DP_Prabh 38

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 30 Most Valuable Professional

Last 30 days Overall leaderboard