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

  • 7 April 2022
  • 6 replies

Userlevel 3

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

6 replies

Userlevel 7
Badge +5

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.

Userlevel 3

Awesome @Dmitrii Naumov thank you very much!

Hi @Dmitrii Naumov . Can you provide an example for how to use PXAdapter to retrieve the corresponding cache Current?

Userlevel 7
Badge +5


I don't think it is something that should be done. 

You can have two different types of actions:

  1. Action that affects the current record on the screen, it can work with Current of the cache.
  2. Action that is not necessary working with the currently displayed record, e.g. any action that can also be be triggered from a processing screen for multiple records at the same time. 

So you either use Current of the cache or PXAdapter to get record(s). 

These two should not be mixed together.

Thanks for your quick response @Dmitrii Naumov .

I understand and agree with what you said. Just curious if you have examples of how to use PXAdapter as its API is rather cumbersome and annoying to use (though it could be that I don’t fully understand how it should be used).

Userlevel 7
Badge +5

@colinsim an example of how to use PXAdapter to get records to process can be found for instance in SOOrderEntry graph:

List<SOOrder> list = adapter.Get<SOOrder>().ToList()

So, it should be pretty straight forward. 

As I mentioned before, if you work with PXAdapter, you can expect that there may be multiple records sent to be processed, hence the List instead of a single record. 


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