Solved

Not able to hide buttons added to the base graph by a graph extension


Userlevel 7
Badge +8

Hello Gang,

 

I am trying to hide 3 buttons of Acumatica as I have added 5 custom buttons to either replace or add more functonality. Out of these 3 Acumatica buttons 1 (releaseFromHold)  is created by acumatica in Base Graph and the other 2 (approve and reject) in one of Acumatica’s own graph extensions. Using RowSelected event I’m trying to hide these 3 buttons. My code hides the one from the base graph (releaseFromHold) but the other two (approve & reject) remain visible. Why? Here is my little event code:

 

protected virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
var row = e.Row as APInvoice;

if (row == null) return;

APInvoiceEntry_ApprovalWorkflow BaseAM = Base.GetExtension<APInvoiceEntry_ApprovalWorkflow>();

Base.releaseFromHold.SetVisible(false);
BaseAM.approve.SetVisible(false);
BaseAM.reject.SetVisible(false);
}

 

icon

Best answer by markusray17 17 May 2022, 20:37

View original

7 replies

Userlevel 7
Badge +8

UPDATE:

I tried this as well but no luck 

[PXOverride]
[PXHidden]
public PXAction<APInvoice> approve;
[PXButton(CommitChanges = true)]
[PXUIField(Visible = false)]
protected virtual IEnumerable Approve(PXAdapter adapter) => adapter.Get();

 

Also I set the  Vsible to false on screen but it didn’t work either

 

 

Userlevel 5
Badge +3

@aaghaei , 

1. you can hide approve/reject actions on the AP Preferences, approval tab (see attachment)

  1.  if you need to customize it through the code, you should not get the graph extension through the .GetExtension method (this is for the DAC extensions). You need to define the extension where you want to place the code as a graph extension of the APInvoiceEntry_ApprovalWorkflow:   
     
    public class APInvoiceEntry_ApprovalWorkflow_Ext : PXGraphExtension<APInvoiceEntry_ApprovalWorkflow,APInvoiceEntry_Workflow        , APInvoiceEntry>

     

Userlevel 6
Badge +5

If you need to customize it via code you likely need to modify the visibility via the Workflow API, it will typically override any event based code(as it runs afterward). 

The GetExtension method does work for graph extensions and I’m fairly certain it is the proper way to get an extension from the base graph.

In order to modify the workflow via code though you would want to extend the specific graph(APInvoiceEntry_ApprovalWorkflow) and override the Configure method. The T270 training covers how to modify workflows.

Userlevel 7
Badge +8

Thanks @mvolshteyn and @markusray17 

The problem with AP workflow is, it unlike other screens doesn’t allow to “Add Workflow” to the screen. In other screens we can but not in AP301000 and AR301000. I’m not sure why Acumatica has restricted them.

 

 

Userlevel 6
Badge +5

You can still modify it via code, just not via the customization editor. That’s what I was referring to when you override the Configure method in a graph extension. 

Userlevel 7
Badge +8

UPDATE

@markusray17 @mvolshteyn @Chris Hackett 

Finally I figured out what is happening. The case is if we add the actions to our favorites by staring (*) them, Acumatica will then adds them to “FavoriteActionRecord” table. It appears actions added to this table, overrides the Show/Hide in RowSelected event handler. When I remove the Star from actions, everything works just fine. When I star then system shows the action buttons on my screen all the time even if I try to hide them through an event handler.

Userlevel 7
Badge

Thank you for sharing this update @aaghaei !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved