Forum Discussion
PowerApps: Using Buttons to Update Existing Records
- Jul 18, 2023
Hi zlasek
you already have a form "Form1" with the "ApprovalDecisionDatacard1"
Select that card and select "Unlock to change properties" on the right sideThe create a new Button "Approve" and set it's OnSelect Property to
Set(varApprovalResult,"Yes")
and another Button "Reject" and set it's OnSelect Property to
Set(varApprovalResult,"No")
Then select the ApprovalDecisionDatacard1 and set it's Default Property to "varApprovalResult"and the Property "Visible" to false
This should be enough to fix your usecase.
But you should also initialize the "varApprovalResult" variable in the "On Visible" property of your screen "Details" likeSet(varApprovalResult,BrowseGallery1.Selected.ApprovalDecision)
and enable/disable your "Approve"/"Deny" buttons by using this formula in their "DisplayMode " properties
If(varApprovalResult="Yes",DisplayMode.Edit,DisplayMode.Disabled)
Best Regards,
Sven
Hi zlasek
you already have a form "Form1" with the "ApprovalDecisionDatacard1"
Select that card and select "Unlock to change properties" on the right side
The create a new Button "Approve" and set it's OnSelect Property to
Set(varApprovalResult,"Yes")
and another Button "Reject" and set it's OnSelect Property to
Set(varApprovalResult,"No")
Then select the ApprovalDecisionDatacard1 and set it's Default Property to "varApprovalResult"
and the Property "Visible" to false
This should be enough to fix your usecase.
But you should also initialize the "varApprovalResult" variable in the "On Visible" property of your screen "Details" like
Set(varApprovalResult,BrowseGallery1.Selected.ApprovalDecision)
and enable/disable your "Approve"/"Deny" buttons by using this formula in their "DisplayMode " properties
If(varApprovalResult="Yes",DisplayMode.Edit,DisplayMode.Disabled)
Best Regards,
Sven
- SvenSieverdingJul 18, 2023Bronze Contributor
Sure, this works like disableing the buton. Set it's "Fill" property to a different color depending on the variable varApprovalResult like this (Sets the button's color to grey, if approved and to green otherwise)
If(varApprovalResult="Yes",Color.Grey,Color.Green)
Or more with more colorsIf(varApprovalResult="Yes",Color.Grey,If(varApprovalResult="No",Color.Black,Color.Green))
(Sets the button's color to grey, if approved and to black, if not approved and to green otherwise)
Best Regards,
Sven