What is the purpose of the PXAdapter parameter for Actions functions?

  • 7 April 2022
  • 2 replies

When you create a new Action in Acumatica you have two ways of doing it:

1) Using PXAdapter

public virtual IEnumerable migrateSalesPeopleFromAcumatica(PXAdapter adapter)
///Any Code
return adapter.Get();

2) Without PXAdapter as parameter

public virtual void migrateSalesPeopleFromAcumatica()
///Any Code


So my questions are:

1)  What is the purpose of the PXAdapter parameter?

2) When should I use one option over the other one?




Best answer by Dmitrii Naumov 7 April 2022, 17:40

View original

2 replies

Userlevel 6
Badge +1

PXAdapter contains some additionalinfo about the invoked action and state of the screen. 

E.g. PXAdapter contains Searches that allow you to identify what records the action has been triggered on. 

Also, return from an action with PXAdapter contains info on what to display after the action completion. 


Action without PXAdapter is kind of independent from the context it has been invoked from. Well, you can still access the graph and Currents of the caches, but Currents of the caches is something that you cannot really rely on. 


So, my recommendation would be to use action with PXAdapter when you need to process some record/list of records. And if your action just does something that does not need to know what record it was invoked on you can use Action without PXAdapter.


Remember that actions can be invoked from different contexts. E.g. if you have ‘Release’ action on some form, that same action can also be invoked from a GI that is mapped from that screen. Or from API. Or from a processing form that uses that actions from Automation. So, the cache Current is really not something that is reliable, as in different situations it may be set or may not be set. And some actions may be triggered on set of records instead of just one record that you’d expect when you just use an action from a screen.

Awesome @Dmitrii Naumov thank you very much!


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 — 2020  Acumatica, Inc. All rights reserved