AnsweredAssumed Answered

How do I get user info from userID

Question asked by vsangal on Oct 9, 2017
Latest reply on Oct 12, 2017 by cjose

I have been researching and found out that this is the best way to current usr info from activiti DB. However, it comes out to be null.

 

This is my code..

First, I get userID

 

List<IdentityLink> identityLink = processEngine.getRuntimeService().getIdentityLinksForProcessInstance(processID);

Iterating through this I get userID

 

if (identityLink != null){

 

                    for (IdentityLink link : identityLink){
                        userID = link.getUserId();
                        logger.info("getProjectID:  userID ==== is " + userID);
                    }
                }else{
                    logger.info("getProjectID: userID is NULL ");
                }

Now I try to get userinfo, this is null.. Can someone help?

 

User user = processEngine.getIdentityService().createUserQuery().userId(userID).singleResult();

 

if (user !=null){    
                    logger.info("FirstName ======= " + user.getFirstName() );

                    logger.info("LastName ======= " + user.getLastName() );

                    logger.info("Email ======= " + user.getEmail() );

                    logger.info("Password  ======= " + user.getPassword() );
                }else{
                    logger.info("user  is ......................... NULL ");
                }

Outcomes