CMDBuild Forum

cmdb.queryClass Problem

Hello,

I'm writing a custom process using the workflow editor and I'm trying to retrieve data from the Email attribute within the "Users" table for the current user.

 

I'm using the following:

myCurrUserId = _CurrentUser.getId();

myUsersList = cmdb.queryClass("User").withAttribute("Id", currUserId).fetch();

myUserGet = myUsersList.get(0);

myUserMap = myUserGet.getAttributes();

myUserEmail = myUserMap.get("Email");

cmdb.newMail()

.withFrom(cmdbserver@domain.com")

.withTo(myUserEmail)

.withSubject("Hello E-mail")

.withContent("This is a Hello E-mail")

.send();

 

However, when I attempt to call the "Users" class I'm unable to do so and get a method invocation error. This does work if I create my own Contacts class but it then means it won't pull the information for the current user.

Could you suggest how I could pull this information directly from "User"? Alternately, is there scope in the API to have _CurrentUser.getEmail(); reftype?

I'm also quite new to Java so please excuse any stupidity :)

Thanks,

Jamie