ViewBag in Acumatica

  • 13 July 2021
  • 5 replies

Userlevel 1



Can we use the viewBag in Acumatica?

or pass a value for example from Graph CAEntry to CAReleaseProcess 



5 replies

Userlevel 6
Badge +7

Hi Sadok,

Can you tell us more about the requirement and process? There are different ways to pass state between graphs, but using a ViewBag is not possible.

Userlevel 6
Badge +8

Hi @SadokHanini We have used sessions long back, please find the code below.. that may help you.


Store the value in session:

PXContext.Session.SetString( TOKENConstant , tokenIDvalue);

Read the value from Session:

string tokenID = PXContext.Session[TOKENConstant].ToString();


Userlevel 6
Badge +7

@Naveen B I personally think using session state is almost always the wrong solution -- take a look at the business logic in PX.Objects.dll; this is never used except for very very specific cases.

Userlevel 6
Badge +8

Yes @Gabriel Michaud  We have used this session concept long back for specific reason in payment gateways, and currently we are NOT using it.

Since Sadok is looking for the Sessions, I just shared here.

Userlevel 6
Badge +7

I have no doubt you know what you are doing @Naveen B, and payment processing is one of the scenarios where I see it used in PX.Objects 😉

The reason I mentioned it is because there are new users on this forum and they often try to replicate the same patterns they used in other systems without first getting a good understanding of how to do things the “Acumatica way”. This always comes back to bite you later and you discover issues that require major redesigning


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