Skip to main content
Solved

ViewBag in Acumatica

  • Jul 13, 2021 1:49 PM UTC
  • 5 replies
  • 114 views
  • Translate All

SadokHanini
Freshman II

Hello,

 

Can we use the viewBag in Acumatica?

or pass a value for example from Graph CAEntry to CAReleaseProcess 

 

Thanks.

Best answer by Gabriel Michaud

@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.

View original

5 replies

Gabriel Michaud
Captain II
Forum|alt.badge.img+12

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.

Translate

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Jul 13, 2021 2:47 PM UTC

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();

 

Translate

Gabriel Michaud
Captain II
Forum|alt.badge.img+12

@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.

Translate

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Jul 13, 2021 3:01 PM UTC

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.

Translate

Gabriel Michaud
Captain II
Forum|alt.badge.img+12

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

Translate