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 / Set default value in f...
Power Pages
Answered

Set default value in field Subject of web form create case

(0) ShareShare
ReportReport
Posted on by 31

Hi all ,

 

I have create a customer powerapps portal and I want set , with a default value , the field subject .

The Subject is a lookup field type .  I create a basic form metadata , but the field not populated ! 

 

How I do it ?

 

Thanks 

 

 

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

    Hi @Eagle0473 

     

    Are you using Basic Form or Advanced Forms?

    Can you please let us know that subject lookup field is reference to which entity?

     

    Please refer this blog:

    https://dynamicsofdynamicscrm.com/2020/05/29/no-code-way-pre-populate-date-field-to-current-date-in-powerapps-portal-entity-form/

     

  • Verified answer
    - Matt Bayes - Profile Picture
    91 on at

    Hey Eagle,

     

    Unfortunately you cannot set a lookup field in the "Prepopulate" area of the metadata record.

    This is due to the fact that a lookup field is broken into 3 parts - ID, Name, and EntityType.

     

    You will have to write Javascript to prepopulate the field on-load. In order to do this, you should be able to locate the Custom Javascript section on the Entity Form/Web Form itself (or web page depending on requirement) and add something in the following format:

    $(document).ready(function(){
     $("#" + Schema + "_name").val(Name);
     $("#" + Schema).val(GUID);
     $("#" + Schema + "_entityname").val(EntityName);
    });

    You will need to populate the Name of the record into the name field, the GUID of the record, as well as the entity name (schema name).

     

    The easiest route is to pass these as parameters in your form request url and retrieve them in javascript. If that isn't an option, you can always hard-code them in, or use a FetchXml block in a web template to retrieve the associated record to populate.

    If you need further clarification let me know!

    Thanks!

     

    Matt Bayes

  • Eagle0473 Profile Picture
    31 on at

    Hi Matt , thank for replay .

    I insert this script in this position of the web form ?

     

    Eagle0473_0-1634546261509.png

     

     

     

  • Eagle0473 Profile Picture
    31 on at

    Hi , thank you for replay .

    I tryed this solution , but unfortunetly for subject field not work 

     

     

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Eagle0473

     

    You need to insert the script on the portal basic form JavaScript not as per your screenshot. 

    Another alternative is to use Web api as per the below article:

    https://imperiumdynamics.com/blog/Populating-a-lookup-on-Power-App-Portals

     

  • Eagle0473 Profile Picture
    31 on at

    Hi @mbayes , solved !

    Thank you so much

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 65

#2
11manish Profile Picture

11manish 55

#3
Vish WR Profile Picture

Vish WR 29

Last 30 days Overall leaderboard