2
votes

I have a simple SharePoint list named "Test_approval" which contains a choice column(drop-down list) named "approval_status". This choice column has 3 option "approved", "rejected" and "pending". When a new item is created the approval_status is set to "pending". I am trying to create a simple mobile app in power apps which will use a button to update the dropdown value from "pending" to "approved". In power apps my button is "button1" and the approval_status column is named approval_status_DataCard2. I am looking to add a formula the button1.onChange which runs the update and then submits the form. I know how to update a text box using the updatecontext formula "UpdateContext({textboxUpdateVariable:"Approved"})". Can someone point me in the right direction on how to do this for a dropdown value ?

1
The approval_status column is probably named approval_status, it is the data card which is approval_status_DataCard2Meneghino
Your capitalisation is irregular, and PowerApps is case sensitive. Is the choice value 'Approved' or 'approved'?Meneghino
Hi , Meneghino, thanks for your reply, yes choice value is "Approved", that was just a mistake in my question.derek

1 Answers

5
votes

The code you want for the OnSelect property of Button1 is

Patch(
    Test_approval,
    {ID: YourItemId},
    {approval_status:{
        '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
        Value:"Approved"
        }
    }
)

Where YourItemId is the ID of the item in Test_approval. This will be typically be the item selected in a gallery, so could be something like:

Gallery1.Selected.ID