Get Session UserName in BPM

,

I would like to grab the Session.UserName in a BPM but when I try to access it the validation rejects it saying UserName isn’t in Session. I have C# code on a form that access it so why can’t I see it in the BPM? I am using a Set Field object.

Hi Jeanne,

I have gotten user name and placed it in UD fields via bpm in the past. I have used the bpm callContextClient CurrentUserID and put it in a UD. See below where to get it. Is this the same user name you are looking for via session.username?

2 Likes

Not exactly. The Session UserName gives me something like “John Doe” where the CurrentUserID is giving me j_doe. I would be OK with that if I can’t get the UserName. There must be something I am missing adding into the BPM.

Session.UserID

2 Likes

That gives me the user ID like j_doe not the name like John Doe. In the C# code Session.UserName gives me John Doe which is what I want. Why can’t I get that in a BPM?

You can get the UserID like Haso told you, you need to read the UserFile to get the name associated with the userID.

something like:
var userrec =  Db.UserFile where((user.DcdUserID == userID).FirstOrDefault(); 
name = userrec.LastName;

maybe?

Pierre