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

Approval Button in gallery

Hi,

i looked at many posts for this and tried several different options based on patch and update, but somehow i cant get it to work.

i have a gallery based on a sharepoint list. within this list is a choice column called "Confirmed/Pending". It has 3 choices "Confirmed", "Pending" and "canceled. 

i set the default value of the respective edit/new form and this column to "pending". A normal user has no other choice. 

 

Now i placed a button in the gallery and made it visible only to a few users who are allowed to confirm an item.

I am trying to make the button update the value of this item to "confirmed". 

 

Could someone help me on this?

 

thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JR-BejeweledOne
Super User
Super User

Let's change it to this:   I was too hasty when I sent you that last formula, Defaults is used when patching a new record.   Since you are updating a record you don't want to use Defaults and don't reference the column where you are referencing the list.   Not sure why you need the ' ' around Confirmed/Pending.

 

Patch(
    List_Data_QC_Scheduley,
    ThisItem,
    {Confirmed/Pending:
        {
        Value: "Confirmed",
        '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}
        }
    )

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

9 REPLIES 9
JR-BejeweledOne
Super User
Super User

Like this:

 

In your choice field set the DefaultSelectedItems like this:   If(ButtonX.Pressed, "Confirmed", "Pending")

 

Modify as needed.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
Jasper1234
Frequent Visitor

@JR-BejeweledOne Hi, thanks for your input. But im currently in a gallery, i dont have a choice field here. Or which one are you refering to?

JR-BejeweledOne
Super User
Super User

is this choice column not in your gallery?

 

within this list is a choice column called "Confirmed/Pending". It has 3 choices "Confirmed", "Pending" and "canceled.

i set the default value of the respective edit/new form and this column to "pending"

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
JR-BejeweledOne
Super User
Super User

Is your gallery connected directly to a data source or a collection?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

@JR-BejeweledOne  it is, but only in view mode. Ie i dont have a form to submit later. The button basically has to do the "submitting" as well and update the confirmed/pending value of this item in the sharepoint list. 

Its connected directly to the sharepoint list. 

JR-BejeweledOne
Super User
Super User

Then you would want to do something like this on your button select (this assumes your data source is SharePoint):

 

 

Patch(List,
         Defaults(List),
        {
           Choice:   {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:Gallery1.Selected.ID,
                        Value:"Confirmed"}
              }
         )

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

@JR-BejeweledOne , thanks a lot. i tried this way before, but somehow didnt get it to work. It will look like this:

 

Patch(List_Data_QC_Scheduley.'Confirmed/Pending',
Defaults(List_Data_QC_Schedule.'Confirmed/Pending'),
{
Choice: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:GalleryOverview.Selected.ID,
Value:"Confirmed"}
}
)

 

Based on this code the formular still doesnt work, powerapps sais "the column "Choice" does not exist". Can you see the mistake?

JR-BejeweledOne
Super User
Super User

Let's change it to this:   I was too hasty when I sent you that last formula, Defaults is used when patching a new record.   Since you are updating a record you don't want to use Defaults and don't reference the column where you are referencing the list.   Not sure why you need the ' ' around Confirmed/Pending.

 

Patch(
    List_Data_QC_Scheduley,
    ThisItem,
    {Confirmed/Pending:
        {
        Value: "Confirmed",
        '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}
        }
    )

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (52,538)