cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
BigJohn
Level: Powered On

Disabling button in a gallery.

Hi, 

 

I have a gallery connected to CDS Account records.  I have a field in account called "Picked".  If Picked = Blank, then the button is disabled, otherwise it's not.

 

When I press the button, I update the record so that Picked is not blank.  But "auto-disable on select" time isn't long enough for the refresh of data, so the button isn't disabled and the users think that it hasn't worked so press again and again and again...

 

Does anyone have a better idea of how I can do this?

 

Thanks...

 

John

1 ACCEPTED SOLUTION

Accepted Solutions
BegeNCSU
Level: Powered On

Re: Disabling button in a gallery.

How about adding another context variable that is set to that Item? Say your gallery cards are demographics (name, title, manager). Then when a change is made for that control within the item, you can set the OnSelect to UpdateContext({conMode:Disabled , conItem:ThisItem.Demographic}) then the control's display mode could be If(ThisItem.Demographic=conItem,conMode,Edit)

View solution in original post

8 REPLIES 8
BegeNCSU
Level: Powered On

Re: Disabling button in a gallery.

One tactic I often try when a user is making changes is set all the buttons and fields display mode to a context variable. When the screen is first opened I add UpdateContext({conMode:Edit}) to the OnVisible property. Then I enclose any OnSelect action with UpdateContext({conMode:Disabled}) as the beginning and then UpdateContext({conMode:Edit}) at the end. Then you can set the DisplayMode of the control to conMode.

 

image.png

 
BigJohn
Level: Powered On

Re: Disabling button in a gallery.

Thanks for the reply!

 

Yea I thought about doing something similar.  The problem is that the button is part of a gallery card, so doing that will set all the buttons for all the items in the gallery to Edit/Disabled.

BegeNCSU
Level: Powered On

Re: Disabling button in a gallery.

Hey, great minds, am I right?

 

If you only want some of the buttons to be disabled, then you could either only apply the conMode to the buttons that you want disabled while they're waiting on a response or setup a different conMode for each button that you want that functionality for. So you could have a ConModeName, ConModeTitle, ConModeManager....

 

Another thing that I often do is instead of disabling the controls I just add a label that takes up the entirety of the app and in the text have "Please wait while your data is being saved". Though that might be better suited for a form where you wait till the end to save as opposed to a single control/change.

BigJohn
Level: Powered On

Re: Disabling button in a gallery.

Haha absolutely!

 

As I mentioned though, the button is within the gallery "card" (not sure if that's the right terminology) so the button appears in all items in the gallery.  So there's no way I can think of that using a variable that would only disable the button that's been pressed?

 

Hope that makes sense.

BegeNCSU
Level: Powered On

Re: Disabling button in a gallery.

How about adding another context variable that is set to that Item? Say your gallery cards are demographics (name, title, manager). Then when a change is made for that control within the item, you can set the OnSelect to UpdateContext({conMode:Disabled , conItem:ThisItem.Demographic}) then the control's display mode could be If(ThisItem.Demographic=conItem,conMode,Edit)

View solution in original post

Community Support Team
Community Support Team

Re: Disabling button in a gallery.

Hi @BigJohn ,

 

Is your purpose to updating the record with value must be contained in Picked field? If so, you could workaround this by setting below formula in the OnSelect property of the button:
If(!IsBlank(ThisItem.Picked),Patch(....),Notify("Picked mustn't be empty",NotificationType.Error)))


Regards,

Mona 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BigJohn
Level: Powered On

Re: Disabling button in a gallery.

Hi BegeNCSU,

 

Thanks for that.  I did as you said and created another context variable of the item called pickedItem, then on the Display Mode of the button I did:

If(pickedItem.Account = ThisItem.Account, DisplayMode.Disabled, If(!IsBlank(ThisItem.Picked), DisplayMode.Disabled, DisplayMode.Edit))

This has brought it's own little quirks but for the most part it's what I wanted to achieve.

 

Thanks for all your help!

 

John

BegeNCSU
Level: Powered On

Re: Disabling button in a gallery.

Great to hear, keep plugging away!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,828)