Question

I have a problem with the activiti engine, which should be simple to solve, but i can't find the method to call to solve this problem:

My problem is, that every Task Event (org.activiti.engine.task.Event) returnes null by calling Event.getUserId(); If I take a look into the database I see that the database table ACT_HI_COMMENT has null as value for the column USER_ID_ for every row.

I generate these TaskEvents programmatically by calling (for example)

processEngine.getTaskService().addComment(task.getId(),    null, commentMessage);

processEngine.getTaskService().addUserIdentityLink(task.getId(), user.getId(), IDENTITY_LINK_OBSERVER);

I guess there is a simple method that I must call to solve this problem, something like processEngine.setCurrentUser(authenticatedUser.getId());

Any suggestions?

Was it helpful?

Solution

Setting authenticatedUserId in the IdentityService should do the trick:

processEngine.getIdentityService().setAuthenticatedUserId(user.getId());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top