# Get User Information in JavaScript task

**URL:** <https://forum.flowable.org/t/get-user-information-in-javascript-task/627>\
**Category:** Flowable Application\
**Created:** [June 7, 2017, 1:53pm UTC](https://forum.flowable.org/t/get-user-information-in-javascript-task/627 "2017-06-07T13:53:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaimerivera](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jaimerivera](https://forum.flowable.org/u/jaimerivera)\
**Post date:** [June 7, 2017, 1:53pm UTC](https://forum.flowable.org/t/get-user-information-in-javascript-task/627/1 "2017-06-07T13:53:35Z")

</div>

What is the best way to obtain the following user information within a Script (JavaScript) task. I have searched for examples but can’t find any?

1. User name and email for process initiator?
2. User name and email of the user who completed the previous task?
3. Emails for users on a particular group?

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [June 9, 2017, 8:45am UTC](https://forum.flowable.org/t/get-user-information-in-javascript-task/627/2 "2017-06-09T08:45:18Z")

</div>

Is there a reason you specifically want a script task? It makes things a bit cumbersome to write and test.

If you’re using the out of the box users and groups, the answers would be:

1. The initiator is stored as a variable (defined by flowable:initiator). This is the userId. Use this userId to fetch, via the identityService, the other bits of information.
2. If the script task is immediately after the user task, the transaction won’t have been committed yet. You could store the assignee id of the previous task using a TaskListener and put the id in a (transient) variable for example and use same mechanism in (1) to get the info.
3. You’d need to do a UserQuery for a particular group and simply loop over the results.

---

<div class="post-metadata">

**Author:** ![jaimerivera](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jaimerivera](https://forum.flowable.org/u/jaimerivera)\
**Post date:** [June 9, 2017, 2:28pm UTC](https://forum.flowable.org/t/get-user-information-in-javascript-task/627/3 "2017-06-09T14:28:02Z")

</div>

Thank you for the information. I need to do this in a Javascript or Groovy task because I need end-users who using the modeler application can set assignments dynamically.

---

<div class="post-metadata">

**Author:** ![robsoncardoso.ti](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/robsoncardoso.ti/32/779_2.png) [@robsoncardoso.ti](https://forum.flowable.org/u/robsoncardoso.ti)\
**Post date:** [June 30, 2017, 2:19am UTC](https://forum.flowable.org/t/get-user-information-in-javascript-task/627/4 "2017-06-30T02:19:49Z")

</div>

Jaime,

You managed to get these results?

---

<div class="post-metadata">

**Author:** ![jaimerivera](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jaimerivera](https://forum.flowable.org/u/jaimerivera)\
**Post date:** [July 6, 2017, 1:10pm UTC](https://forum.flowable.org/t/get-user-information-in-javascript-task/627/5 "2017-07-06T13:10:03Z")

</div>

Not using the script. I am in the process of implementing a task listener.
