cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheBaz
Frequent Visitor

automatically update field value

Hi All,

 

I created a PowerApps Application from a SharePoint List.  The list name is "Client Information" and in that list, I have a column named touch Point a Yes/No choice column.

 

Each row (or client) in my Application Gallery changes colour based on the value in the touch Point Column.

TemplateFill = If(ThisItem.'Touch Point'.Value= "Yes", RGBA(255, 0, 0, 1),RGBA(0, 255, 0, 1))


Now, I would like the value in touch Point to change when the user selects a client. For example, if the current value is Yes, I want the value to change to No. I tried Patch and UpdateIf but can't get to that result.

Can someone help me fix my formulas? 

 

OnSelect = If(ThisItem.'Touch Point'.Value="Yes",Patch('Client Information',ThisItem.'Touch Point',{'Touch Point': {Value:"No"}}))

 


Cheers,

Thebaz

 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

Hi @TheBaz 

Put an icon in the gallery and set its OnSelect property to 

UpdateContext({tp: !tp});
If(
    tp,
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "Yes"}
    ),
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "No"}
    )
)

 This will toggle the Touch Point from yes to no.  

View solution in original post

2 REPLIES 2
Drrickryp
Super User
Super User

Hi @TheBaz 

Put an icon in the gallery and set its OnSelect property to 

UpdateContext({tp: !tp});
If(
    tp,
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "Yes"}
    ),
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "No"}
    )
)

 This will toggle the Touch Point from yes to no.  

TheBaz
Frequent Visitor

Thank you for your assistance. I ended up with this script, but I accepted your answer since it helped be aswell.

 

If(
ThisItem.'Touch Point'.Value = "No",
Patch(
'Client Information,'
BrowseGallery1.Selected,
{
'Touch Point': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: "Yes"
}
}
),
Patch(
'Client Information',
BrowseGallery1.Selected,
{
'Touch Point': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: "No"
}
}
)
)

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,612)