Skip to main content
Solved

Set Button conditionally visible

  • December 11, 2022
  • 7 replies
  • 482 views

Michael Ndungi
Varsity I
Forum|alt.badge.img

hello everyone. How can I conditionally set the Pay button to not be visible when  I select a specific payment method.

 

Best answer by aaghaei

@development93
@ddunn 
I believe the suggested even handler for UI controls status management is RowSelected and don’t forget to set CommitChanges = true for the driving field. RowUpdated will be triggered only if a change is made and if a document with the specific type is selected and no change is made the button will be visible. Please note there is a known issue in Acumatica that if a button is added to the user favorite, then always will be visible.

View original
Did this topic help you find an answer to your question?

7 replies

Forum|alt.badge.img+6
  • Captain II
  • 579 replies
  • December 11, 2022

I would expect to do this in the RowUpdated event. You can call the .SetVisible method of the button/action to show/hide it accordingly.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • 1206 replies
  • Answer
  • December 11, 2022

@development93
@ddunn 
I believe the suggested even handler for UI controls status management is RowSelected and don’t forget to set CommitChanges = true for the driving field. RowUpdated will be triggered only if a change is made and if a document with the specific type is selected and no change is made the button will be visible. Please note there is a known issue in Acumatica that if a button is added to the user favorite, then always will be visible.


Michael Ndungi
Varsity I
Forum|alt.badge.img

Appreciate for all your responses. is it possible if anyone could share an example?

 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • 1206 replies
  • December 11, 2022

@development93 
there are lots of samples on community or stackoverflow but here is one. You can set the true or false value on the fly based on your document type verification you are referring to.

https://stackoverflow.com/questions/44120573/disable-action-buttons-conditionally-aef


Forum|alt.badge.img+6
  • Captain II
  • 579 replies
  • December 11, 2022

@aaghaei- you’re right - I just happened to have the training materials open and the example I was looking at was the event to use when you need to update another record when the current record is updated.

I think @development93 wants to look at FieldUpdated as well as RowSelected because the user could change the payment method after selecting the row.

In T210, in Step 3 there is an example around changing the enabled status of a field.

See if that helps you get started. Use the Ctrl+Alt keyboard shortcut to get the details on the Pay button. If it is defined as a PXAction (I would expect so) then you can use graph.action.SetVisible.

 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • 1206 replies
  • December 11, 2022

@ddunn

It was a while ago I studied the materials but if I am not mistaken, RowSelected event is triggered multiple times before and after other events including RowUpdated. So if the visibility control developed on RowSelected it should do the work without RowUpdated alteration.


Yuriy Zaletskyy
Jr Varsity I
Forum|alt.badge.img+3

Couple of points, if you want to do that via RowSelected:

  1. RowSelected of Main DAC class, not secondary
  2. Make sure that your rowselected doesn’t conflict with Acumatica base code
  3. Acumatica in newer versions adds more and more extensions, so make sure, you analyze base Acumatica extensions
  4. Make sure, that other customizations doesn’t meddle with making button visible.

As alternative, you can also try to use javascript. This link describes usage of js in scope of SignalR, but you can understand abou js as well.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings