How do I get user info from userID

cancel
Showing results for 
Search instead for 
Did you mean: 
vsangal
Active Member II

Re: How do I get user info from userID

Jump to solution

That didn't work either.. Maybe I have to call it from service task..

vsangal
Active Member II

Re: How do I get user info from userID

Jump to solution

I mean script task

cjose
Senior Member II

Re: How do I get user info from userID

Jump to solution

It would help if you can post all the details such as bpmn file, service java code etc in one post when asking questions. From this post, it is difficult to understand whether you are doing it from a service/script task or even execution/task/event listeners etc. Also, if this is getting executed without a user context (ie, async) you won't have any user info where your bpmn definition will help! 

vsangal
Active Member II

Re: How do I get user info from userID

Jump to solution

of course thanks Ciju.

I think I found a bug in the system.

I am now able to get userinfo through SecurityUtils.getCurrentUserObject(); Only if the form in previous activity (not activiti) does not have a file upload option with Alfresco repo enabled.

So i have a form on start event which has attach file option and after that i have service task which calls javadelegate and it prints the user info if I don't enable alfresco repo files to be attached.

vsangal
Active Member II

Re: How do I get user info from userID

Jump to solution

Steps:

1. Create a form with attach file and configure it accept local files and alfresco files.
2. Create a java api or bean .. add code to capture userinfo .. see attachment for example.
3. Create a process with start event -> service task -> end
4. attach form to start event and configure service task to call your java api
5. check the log and you will see that userinfo in null.

Now remove the alfresco option and republish the app and run it again. UserInfo is now available

cjose
Senior Member II

Re: How do I get user info from userID

Jump to solution

Yeah, now it makes sense. When you add an attach file option in the form, the next task will turn async. That means it is no longer executed under the logged in user context! Hence you get null. Try executing your logic from an execution listener attached to the start activity or on the sequence flow if you really need the user context. It is not a bug, it is working as designed.