BPT | Session value is returning 0

Hi Devs,

I'am having problem keeping the Session value filled in a form, I'am using BPT and bellow I describe what is happening.

I grab the UserID filled in the form and put it in the assign using a session variable(Session.UserdId = Form Value), and applying the breakpoint I see that the value is assigned to the variable.

But the problem starts when the ActivityClose API is called and the onClose method of my activity is called, I try to see if the value is in the onClose method of the activity  but I get 0 in return. In my onClose method I put a local variable and via assign I try to get the session variable that is returning 0.

Does anybody know how to solve this problem?

I'um using Service Studio 10 and BPT

Best Regards

Vanilson Lourenço wrote:

Hi Devs,

I'am having problem keeping the Session value filled in a form, I'am using BPT and bellow I describe what is happening.

I grab the UserID filled in the form and put it in the assign using a session variable(Session.UserdId = Form Value), and applying the breakpoint I see that the value is assigned to the variable.

But the problem starts when the ActivityClose API is called and the onClose method of my activity is called, I try to see if the value is in the onClose method of the activity  but I get 0 in return. In my onClose method I put a local variable and via assign I try to get the session variable that is returning 0.

Does anybody know how to solve this problem?

I'um using Service Studio 10 and BPT

Best Regards

Hi Vanilson,  Asynchronous logic like Timers and Process Activities run in a separate session. This means that when we execute an action associated with a timer, all session variables will have their default values. As an example, the UserId session variable will have the value of Null Identifier.


Solution

So If you want to use the UserId you must query the DB to retrieve the user, if you are using a Wait tool you can add an UserId Output parameter and this one will become the input parameter from the On close


Hope I could help you

Best Regards

Carlos Lessa

Solution

Hi Vanilson, 

As Carlos explained  Timer and  BPT does not run in specific logged in user account rather they have there own session which doesn't give you any information about the users.

There are other ways to do it like after launching the process you can keep the user id with the process id in db and than you can get it back using process id with your activity.

I am not sure at this point what is you exact need but in the bottom line is you cannot get the userid from session variable in bpt process .


Regards,

-PJ-

Hi Devs,

Thanks for the inputs, I solved the problem querying the user table using the onClose.

Best Regards