cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Changing field by pressing button

Hello.

I have a list with some help desk tickets.

It has a field named as Status. Status can be: New, In progress, Finished.

I am trying to make a button which will change the Status to Finished and it will close the ticket.

How I can make such button?

 

I have seen this topic

https://powerusers.microsoft.com/t5/Building-Power-Apps/Change-field-on-Sharepoint-list-to-YES-on-bu...

 

But it is not working.

Or I made a mistake in syntax.          Patch('ListName',Field:Value) like this or not?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Changing field by pressing button

OK @ppl ,

Try the heavy artillery 

UpdateIf(
   'Facility Desk',
   Title = Gallery1.Selected.Title,
   {
      Status: 
      {
         '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
         ID: 1,
         Value: "Finished"
      }
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

20 REPLIES 20
Highlighted
Super User III
Super User III

Re: Changing field by pressing button

@ppl 

Yes, there is mistake in your syntax.  The 2nd argument telling PowerApps which specific record to PATCH is missing.  Also, the 3rd argument must be enclosed within these braackets { }.

 

Patch('ListName', ID = 1, {Field: Value}) 

 

The 2nd argument could be written in many ways depending on where the button is located in your app (e.g. form, gallery, on the canvas).  If you need more directions let me know.

 

Some possible examples:

 

Patch('ListName', LookUp('ListName', ID = ThisItem.ID), {Field: Value}) 
Patch('ListName', LookUp('ListName', ID = Gallery1.Selected.ID), {Field: Value}) 
Patch('ListName', LookUp('ListName', ID = Value(DataCardValue_ID.Text)), {Field: Value}) 

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Super User III
Super User III

Re: Changing field by pressing button

Patch(ListName, First(Filter( ListName,Status="New") ), {
Status: “Finished” } )
Highlighted
Super User III
Super User III

Re: Changing field by pressing button

@eka24 

The question was: "how do I change the status of the existing record?" but your post will create a new record.  I don't believe your suggestion is the right way to go 😞

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Super User III
Super User III

Re: Changing field by pressing button

I misunderstood the question.
Highlighted
Helper IV
Helper IV

Re: Changing field by pressing button

It looks like the right answer, but again something wrong with syntaxСнимок.PNG

Facility Desk is the name of my sharepoint list.

Highlighted
Super User III
Super User III

Re: Changing field by pressing button

@ppl 

Please send a screenshot of the error message.

 

One idea might be you forgot a semi-colon, comma or bracket prior to this code.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper IV
Helper IV

Re: Changing field by pressing button

I've tried to edit my function, and now there is more mistakes🤔

1.png2.png3.png4.png5.png

Highlighted
Super User III
Super User III

Re: Changing field by pressing button

Hello @ppl ,

I have posted here to progress the issue and assist my colleagues @mdevaney and @eka24 

You are obviously patching from a button not located on the form record. If this item has been selected from a gallery (I will use Gallery1 - replace with your name), instead of ThisItem.ID, put Gallery1.Selected.ID

Highlighted
Helper IV
Helper IV

Re: Changing field by pressing button

Data source looks like Choices([@'Facility Desk'].OData__Status)

1.jpg

But it cant find such value as "Finished"

2.jpg

 

I have found another solution:

3.jpg

It works, but it always changes only first item in the list

 

 

4.jpg

For example if I edit test3 item and click Finish, item "hello" is changing to finished, but not test3.

I think it depends of gallery1 in my formula. For what i need this certain keyword? 

which my name, you mean, I need to use? 

And ofcourse my solution with selecting status in choise box its workaround. 

It will better if you help me to understand how to make all this actions in one button.

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

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