How to, using image as button to set a value of a field OnSelect. I have a PowerApp associated with a SharePoint list access through Edit Form in list from SharePoint Online. I have an image I would like to use as a button. When said button is clicked I want to set a value in the list to update the list value.


1 Answer 1


PowerApps lacks the ability to directly set the value of a field via an event. Instead, it has a more excel-like mechanism:

Set the value of your field to be a variable, such as varMyVariable. To clarify, what I mean by saying "the value of your field" can be a bit tricky, depending on how your form is configured, but the common scenario would be the default property of the datacard:

myField_datacard5.default = varMyVariable

In the onselect event of the button, use the "set" function to set the value of the variable as desired:

button1.OnSelect=Set(varMyVariable,"some value")

Of course, there are few things in PowerApps that are actually simple. the default will likely be the following:


You'll need to unlock the card to change this. And, if you actually set it to what I suggested, then this will cause issues for updating rows, as the card won't display the existing value, but instead will show the current value of the variable. So perhaps in the screen's onvisible event, or the app's onstart event, call the set function to initialize the variable with the appropriate value so the card displays something other than a blank value. Or, an alternative is to display the value of the field if the variable is currently blank:

myField_datacard5.default = if(isblank(varMyVariable),thisitem.myfield,varMyVariable)
  • I have consistently come across this explanation but I can never find an example of the correct syntax for the OnVisible event to capture the fields actual original (database ) value. I would appreciate it if you could edit the question with this. For example, Set(vConfirmed,ThisItem.tglConfirmed) is invalid in the OnVisible property.
    – Nick.Mc
    Mar 4, 2021 at 11:04
  • in my example, thisitem.myfield IS the original database value that's fed to the form. It's invalid in the onvisible property of the screen, as the screen doesn't have a "thisitem". "thisitem" is available within the form. Given an app created by the wizard, with a gallery and separate screens for view and edit, you could capture the value of a field in the gallery when navigating to the view or edit form, or in the onvisible of the form as Set(var,BrowseGallery1.Selected.myfield)
    – Mike2500
    Mar 4, 2021 at 16:05
  • Thanks for coming back to me. I'm selecting the record based on URL parameter values so my current record is in a variable (set by Lookup) rather than a gallery. Then I set Item for the form to this variable. This all works correctly. I just can't get this convoluted variable approach to work and have concerns about it's maintenance. I'll continue investigating and create a new question if I can't crack it.Thanks again
    – Nick.Mc
    Mar 4, 2021 at 22:30
  • I created a new question here and would appreciate any input that you have. stackoverflow.com/questions/66485627/…
    – Nick.Mc
    Mar 5, 2021 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.