Notifications
Announcements
Hello, I have a customised form for a sharepoint list. I want to update field B with the value of field A Is there an easy way to do this? I tried update context (varfieldA_value) onchange of field A and then setting the "default" value of field B to be varfieldA_value.This updates Field B with the correct value. It writes successfully to sharepoint onsubmit.I thought that was all there was too it, but of course when I subsequently open the form field B shows as blank (presumably because the variable varfieldA_Value is now blank.).I hope this makes sense, how can I use the variable to make the change but also have the default as "Parent.Default" so I can see the value from the sharepoint list when I open the record again? I am not sure if I have to use Patch to achieve this? I am new to the whole environment. Very grateful for any advice. Thanks
Hi @seangorm ,
You cannot set the value of a field or control directly like that with a Variable. You can set a Variable and then make that the Default of the control (as you have done). If you also want to see any saved value and only have the Variable if the underlying data field is blank, then you would do this in the Default
Coalesce( Parent.Default, varFieldA_Value )
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
Thanks so much for that Warren, That seems to be working as I had hoped, but only if I change the order of the default on the target field to be, - the Variable gets set onchange of the source field. I hope that makes sense. Thank you - this was driving me mad.
Coalesce( varFieldA_Value, Parent.Default )
Actually Warren....pardon me - your solution works exactly as you describe. I must have had a weird caching issue. Can I just ask, is it possible to add more than one command in e.g. "Default" on "OnChange"?Could I have Set(varA, "A"); Set(varB, "B")? i.e. 2 actions, separated by a ";"?Thanks again for all your help.
Yes - exactly as you have it.
Thanks Warren.For anyone else having this issue, I also needed Jeff's advice as outlined here https://powerusers.microsoft.com/t5/Building-Power-Apps/Global-or-context-variable-unchanged-if-page-not-refreshed/td-p/140570 - there seems to be a bug whereby variables were not being refreshed as-expected and this lead to major confusion when testing - until I implemented Jeff's fix,
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 796 Most Valuable Professional
Michael E. Gernaey 327 Super User 2025 Season 2
Power Platform 1919 268