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 / Dynamics 365 Portal - ...
Power Pages
Answered

Dynamics 365 Portal - Entity list set lookup value on create mode

(0) ShareShare
ReportReport
Posted on by 120

 

Hi,

 

We have 1-M relationship between Contact and Resource Entity. When click "Create" on "Resource Forecast" entity list page, the contact gets set to the login user however we also want to be able to by default set equivalent resource lookup value. Every portal contact is also set as Resource in CRM.

 

I wonder if we need FetchXML or WebAPI call in Entity list to only execute when "Create" is clicked therefore pass contact guid and retrieve equivalent Resource record from CRM and set the lookup value here (screenshto attached)?

 

SetResource.png

 

Categories:
  • H V Profile Picture
    1,510 on at

    Hi @UmerJaved 

     

    You can achieve your requirement by creating a workflow on create of "Resource Forecast" entity. You have to update Bookable Resource field from Contact field.

  • UmerJaved Profile Picture
    120 on at

    Hi @hardikv 

     

    Workflow won't execute until the record is saved whereas in our case we want to set the value as soon as the Create button is clicked therefore form is loaded. 

     

  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    Hi

     

    you can achieve that via JS 

     

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • UmerJaved Profile Picture
    120 on at

    Hi @OliverRodrigues 

     

    Thanks. As per your first link shared, the Odataset and views is the same as entity list whereas in my scenario, the entity list is a different entity(Resource Forecast). And the 2 lookups required to be set on the create form for Resource Forecast are from different entities (Resource and Contact). So I am not sure if suggested solution in the link would work here?

  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    it's not a problem if it is the same entity.. I am not sure if you can use the same Entity List though, I would create 2 different Entity List records.. one to be shown in the Portal.. other with the oData flag enabled

     

    via oData you will retrieve the record ID.. so via JS you can populate your lookup with the record ID 

  • UmerJaved Profile Picture
    120 on at

    Hi @OliverRodrigues 

     

     

    I'll look into the option you suggested. However I have written FetchXML in a web template therefore able to retrieve the Guid from the resource record (attached screenshot).

     

    Now the question how do I setup the resource lookup value on the create form so it is only set when "Create" is clicked from the entity list web page?   I tried to setup the lookup value in web template within Fetch XML result however it didn't work.Lookup.PNG

     

    ResourceDetail.PNGCreateForm.PNG

  • H V Profile Picture
    1,510 on at

    Hi @UmerJaved

    You have to put liquid code in single quotein javascript.

    $("#ao_fieldname").val('{{result.name}}');

  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    you can add custom code to validate fields on the submit button.. I guess that's the best place to put your logic

     

    https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/add-custom-javascript#additional-client-side-field-validation

     

  • UmerJaved Profile Picture
    120 on at

    Hi @OliverRodrigues 

     

    I guess it is moreover setting a value on load of the create form instead of submit of the form.  Can we use custom javascript section in entity list form therefore use Fetchxml query/liquid and checking if the create button is clicked therefore set the lookup value?  Screenshot attached.Capture.PNG

  • H V Profile Picture
    1,510 on at

    Hi @UmerJaved 

    If you want to put javascript then you have to put javascript in Web Page's localized content page for your requirement.

     

    It seems that you are adding javascript in Entity List, that is wrong place to put javascript for your requirement.

     

    If you have created a Web Page for create a record, then put javascript in localized content of webpage.

    If you have created a Web Form for create a record, then put javascript in Entity Form record(Additional Settings Tab -> Custom JavaScript).

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Pages

#1
Mohsin Ali Profile Picture

Mohsin Ali 18

#2
11manish Profile Picture

11manish 14 Super User 2026 Season 2

#3
Harshit Chaubisa Profile Picture

Harshit Chaubisa 4

Last 30 days Overall leaderboard