cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
newmay
Helper IV
Helper IV

Set field on save/update

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!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @newmay 

 

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!

View solution in original post

9 REPLIES 9
ragavanrajan
Super User
Super User

Hi @newmay 

 

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.

 

 

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
Dual Super User II
Dual Super User II

@newmay 

 

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

$("#fieldschemaname").val(true);
If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here
Fubar
Solution Sage
Solution Sage

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)

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

 

 

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

newmay_0-1634125608386.png

 

Did I forget something here?

Gwham
Frequent Visitor

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.

 

 

Hi @newmay 

 

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!

View solution in original post

Hey @hardikv that worked thanks!!!!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,393)