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

Click button and update/change dropdown value in gallery

 

Hi everyone,

 

I have a screen for managers with a gallery, a display form, and edit form. The gallery shows the status of purchases submitted that default to Open from an option set (Open, Pending, Approved, Declined). The display form displays all the purchase information from a gallery record for the manager to review. The edit form currently displays the status as a dropdown. I would like to:

1. Add two buttons (Approve and Decline) to the edit form. OnSelect I would like Approve to update the dropdown DDStatus to Pending and submit an update to the record with a pop-up or label verifying the change. Clicking Decline should set the dropdown to Declined and update the record. 

*Note: I can get the buttons to change a dropdown's values outside of a gallery using UpdateContext({Status: "Pending"}) but cannot get it to work inside of a gallery and can't figure out why yet.

 

2. The second thing I would like to do is filter the gallery based on status based on the buttons clicked. I have it partially working but the All button shows all status records (Open, Pending, Approved, and Declined) instead of just Approved and Declined records. 

 

I have the following:

All button: Set(ArchiveStatus, "All")

Approved button: Set(ArchiveStatus, "Approved")

Declined button: Set(ArchiveStatus, "Declined")

 

Gallery
Filter(
PURCHASE,
If(
ArchiveStatus = "All" || IsBlank(ArchiveStatus),
true,
ArchiveStatus = "Approved",
'PURCHASE Status' = [@'PURCHASE Status'].Approved,
ArchiveStatus = "Declined",
'PURCHASE Status' = [@'PURCHASE Status'].Declined
)
)

 

canvasapp.png

 

I'd appreciate any help understanding what I'm doing wrong. Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hey brother,

My bad for not mentioning this. Make sure the argument you are using is a unique identifier. That way, it would try to find that record in the entity and update it's Purchase Status.

//Idk your unique identifier for Purchase but it should be ID or something like PURCHASE ID
UpdateIf(PURCHASES, 'ID' = ThisItem.'ID', { 
    'PURCHASE Status': [@'PURCHASE Status'].'Pending'}
)

 

View solution in original post

4 REPLIES 4
Advocate III
Advocate III

Heyya brother!

I'd like to know what entity you are using, but this should work for you:

Place this code on the OnSelect property of your button within the Gallery.

UpdateIf(colOrders, Order = ThisItem.Order, { 
     'Status': [@'Status'].'Pending'
})


Just change the data source and the argument


Hi @ProjectVelox!

 

The data source is PURCHASES and the dropdown option set is PURCHASE Status.

 

i tried this but it doesn't seem to work 
UpdateIf(PURCHASES, 'PURCHASE Status' = ThisItem.'PURCHASE Status',
{ 'PURCHASE Status': [@'PURCHASE Status'].'Pending'})

 

ThisItem gave an error but using ThisRecord did not. It still didn't seem to work even though the it looked like something was happening.

Hey brother,

My bad for not mentioning this. Make sure the argument you are using is a unique identifier. That way, it would try to find that record in the entity and update it's Purchase Status.

//Idk your unique identifier for Purchase but it should be ID or something like PURCHASE ID
UpdateIf(PURCHASES, 'ID' = ThisItem.'ID', { 
    'PURCHASE Status': [@'PURCHASE Status'].'Pending'}
)

 

View solution in original post

That makes sense, thank you!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (5,435)