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

Update different field in same record (switch)

Hi all, 
Apologies in advance if this is confusing. I'm newer to apps, and from my Flow experience I know I'd use a condition or switch for what I'm trying to accomplish, just not sure how to translate that in the app.

Scenario is paperwork approvals. I've got an "approver decision" ,"submitter status", and "approver status" choice columns in SharePoint. The status columns are view only, while the decision column is actual input. The status columns are viewable in the form and a gallery.

 

Approver Decision ColumnSubmitter Status ColumnApprover Status Column
Under ReviewSubmittedNew
Action RequiredUnder ReviewUnder Review
CompleteAction RequiredAction Required
 CompleteUpdated 
  Complete



When "action required" is the decision, the submitter makes edits to their document, and then uses a toggle in the app to indicate it's been complete, then presses a save button. I'd like to be able to have the "approver status" column reflect "updated", put the submitter status back to "under review". This could go back and forth until the edits are satisfactory.

 

How do I write a switch statement for these scenarios to change all the statuses and patch them back to SharePoint? Is this possible? 

 

Thanks in advance!

1 REPLY 1
BCLS776
Super User
Super User

You can use a Switch statement in the OnSelect of that button to do one of several patches. Something like this:

With({ aLookup: LookUp()}, ​// a lookup that pulls up the current record you are handling
    Switch(aLookup.'Approver Decision',
        "Under Review",
            Patch(mySPList, aLookup, {}), ​// Update records as necessary in braces
        "Action Required",
            Patch(mySpList, aLookup, {'Approver Status': "Updated", 'Submitter Status': "Under Review"},
        // Add a no-match behavior here
    )
)

Make sense? The key is getting the With() statement to refer to the record you are currently working on.

 

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Helpful resources

Announcements
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,111)