cancel
Showing results for 
Search instead for 
Did you mean: 

Get $INITIATOR name

stb
Champ in-the-making
Champ in-the-making
Hi,

in version 5.19+, ${initiator}  was refering to initiator's name, but with version 6.Beta2, it only returns initiator's id.
What's the best way to get his name. I need it for sending emails for instance.

Thanks in advance,
Best regards
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
It's indeed the id, you will need to use the userservice to actually find the user + its email. (you can inject the UserService in your custom service task bean for example).

stb
Champ in-the-making
Champ in-the-making
Hi,

thank you very much for the answer. I still couldn't find <em>initiator</em> lastName work until I discovered that the users were created in 'ACT_ID_USER' table but not in "USERS" table as the admin, and my initiator being admin (in USERS), no way to get his infos! A related issue is User creation which cannot be automated neither with the API, nor the REST API which uses the same table. Will these tables be merged in version 6.0 as the API so far seems uncomplete and not fully usable (if I understand well!).

>It's indeed the id, you will need to use the <em>userservice</em> to actually find the user + its email. (you can inject the UserService in your custom service task bean for example).
I've used this Groovy snippet in a Script Task, creating a new user.
<code>
def user = identityService.newUser("100");
user.setFirstName("John");
user.setLastName("Bar");
//…
identityService.saveUser(user);

def query = identityService.createUserQuery().userId("100");
def res =query?.singleResult();
println "id = ${res?.getId()}, firstName = ${res?.getFirstName()}"
</code>

By <em>UserService</em>, were you refering to <em>IdentityService</em>?
I don't understand the sentence "you can inject the UserService in your custom service task bean for example". I've searched in User Guide, but don't have a clue about where to start, sorry.

Thanks again,







jbarrez
Star Contributor
Star Contributor
I'm not sure I'm following - the Activiti 6 UI does not use the 'old' tables, all should be in USERS.
But i do understand the confusion - this is something we'll want to fix soon and make sure the identity service works irregardless.

stb
Champ in-the-making
Champ in-the-making
Hi,

thanks for your answer.
>I'm not sure I'm following - the Activiti 6 UI does not use the 'old' tables, all should be in USERS.
But, I created a simple Script Task  in Activiti 6beta2 (and a clone of beta3) Modeler, and pasted the above code there… and Users are always created in ACT_ID_USER ! 
Maybe I missed something in configuration ?!

> But i do understand the confusion - this is something we'll want to fix soon and make sure the identity service works irregardless.
This will be welcomed indeed!

Best Regards

jbarrez
Star Contributor
Star Contributor
>and Users are always created in ACT_ID_USER !

Yes. The engine goes to ACT_ID_USER for default user creation. The UI goes to USERS. That's exactly the confusion.