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 field on save/update
Power Pages
Answered

Set field on save/update

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi! 

 

I want to set a field attribute on save - its an boolean field. Yet with entity metadata it wont work. 

It is regarding the profile web form on the portal. 

 

Could you help me out to solve this with javascript? (To set the value after I submitted/updated the form via click on the button)

 

Thanks!

Categories:
I have the same question (0)
  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @Anonymous 

     

    Please have a look at the following article 

     

    https://carldesouza.com/get-and-set-field-values-using-formcontext-and-javascript-with-dynamics-365/ 

     

    Hope it helps.

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

    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.

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey @ragavanrajan  thanks! 

     

    So basically I can copy the code from the article, yet how do I combine it with the click on the button, since it is on the portal.

     

    I need the field value to be set after the user clicks/submits the form on the portal.

     

    Thanks

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Anonymous 

     

    In your Entity Form or Web form, you can use the below:

    $("#fieldschemaname").val(true);
  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    If the issues was just that you couldn't get Metadata to set it, it is possible you tried setting it 0/1 rather than true/false (Boolean wont take an index number like other option sets do).

     

    Note: you can set it using JavaScript as suggested by Mira if the field is on the form and editable (hint: you may need to hide it with CSS or jQuery if you don't wan the user to see it)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    HI @Mira_Ghaly thanks for reaching out!

     

    I put the code with the fieldname into the Custom Javascript section within the "Additional Settings" Tab.  

    newmay_2-1634125357260.png

     

    newmay_1-1634125158344.png

     

    Yet it is still on the Profile Web Form 

    newmay_3-1634125389396.png

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Fubar Hi I did as Mira suggested! Yet no change. 

    newmay_0-1634125608386.png

     

    Did I forget something here?

  • g.whammond Profile Picture
    37 on at

    Your field is a two option, so it's likely you will have to select the relevant option via jQuery instead of setting a text value. You should also be able to set this via meta data. Try true/false if 1/0 did not work.

     

     

  • Verified answer
    H V Profile Picture
    1,510 on at

    Hi @Anonymous 

     

    Please use below code:

    $("#bbg_approved").prop("checked", false);
    $("#bbg_approved").closest("td").hide();

     

    --------------------------
    If you like this post, give a Thumbs up. Where it solved your query, Mark as a Solution so it can help other people!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey @hardikv that worked thanks!!!!

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
11manish Profile Picture

11manish 62

#2
Valantis Profile Picture

Valantis 46

#3
rezarizvii Profile Picture

rezarizvii 43

Last 30 days Overall leaderboard