Get all users from group in cam-script directive - embedded form

Hi @all,

I searched for days in different forums and the documentation, but can’t find a hint to list all users of a group in the cam-script directive of a custom embedded form to use them f.e. as cam-choice variable inside .

I just found a solution with execution listener:
I parsed the result in a HashMap and stored it as global variable.

So far so good. But the Problem is, that I want to use the list/map inside custom embedded start form and the global variables are just visible after complete of the start form. So I can’t access them at the start of the form.

Is there any solution? Maybe with $rootscope injection?

Best regards

@ svogel - Can you try by setting the “aync before” on the start shape and see if it works .

The same result, unfortunately. I think I can not read gloabl variables, I set during the same task.
But thank you for the answer.

Hi @svogel,

depending on the type of form, you can use the REST Api to query for users:

Hope this helps, Ingo

I had the same issue and searched some hours to find the solution, how to create a selectable user list in an embedded form:

  1. In an ExecutionListener you can create a variable with the UserList like this:
    List<User> userList = execution.getProcessEngineServices().getIdentityService().createUserQuery().memberOfGroup("user-group-id").list();
            ObjectValue customerDataValue = Variables.objectValue(userList)
            execution.setVariable("users", customerDataValue);

Attention: You have to call the Listener before your Task where the embedded form is, because the embedded form will be called before your Listener.
To use the ObjectValue correclty, you will have to integrate org.camunda.spin in your project. Camunda offers a good description for this.

  1. In your embedded form you will have to call the variable you created with your Listener:
    <label for="selected_user">Choose your Gefa leader</label>
    <script cam-script type="text/form-script">
        camForm.on('form-loaded', function() {
        camForm.on('variables-fetched', function() {
          $scope.gefaLeaders = camForm.variableManager.variableValue('users');
    <select cam-variable-name="selected_user"
            ng-options="c as for c in users track by c">
  1. Make sure your users have the right authorisations. They will need the authorization to READ on Resource USER and they will need rights on the Resource GROUP.

And thats it. Following these steps I was able to select users from a drop down list.

I hope this helps.