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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Set default value in f...
Power Pages
Unanswered

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,413 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard