How to Get UserId of selected user in form .

1
0
-1

I create one form with select field , and add initial value is list of user in that select field .

  1. import org.bonitasoft.engine.identity.*;
  2.  
  3. List<User> users = apiAccessor.getIdentityAPI().getUsers(0, 200, UserCriterion.FIRST_NAME_ASC);
  4. Map<String,Long> combo = new HashMap<String,Long>();
  5.  
  6.  
  7. for(User u:users)
  8. {
  9. combo.put(u.getFirstName(),u.getId());
  10. }
  11.  
  12. return combo

now when user select any one user task will assign to that user , for that i have to fatch userId of selected user into variable for use into ActorFilter

how can i fetch that selected user's UserId ????????

pl provide groovy script for that

thanks kandarp

Comments

Submitted by santillanh on Mon, 04/28/2014 - 18:43

Excuse me please. I think I was not very clear, I need to capture the user logging in form. As I can do?.

Thank you,

1 answer

1
0
-1
This one is the BEST answer!

Hello,

In your widget, you have an "output operation". So, for your widget, set the result of the field to a variable. Set in the left part your variable name Set in the rigth part the field_select.

You don't need any groovy script to do that (except if you want to change the type).

See a simple example here: https://www.dropbox.com/s/tet35fpxch3s085/RetrieveUserid-1.0.bos

Note that the field return a String type (even your map contains String and Id). The String contains the User id. In the next step, then you can based your actor filter on the content of this variable.

Comments

Submitted by ronak on Wed, 04/16/2014 - 18:28

Please note that it returns string (userid) - you will have to convert string type to long in order to assign the next step to that user.

Submitted by santillanh on Mon, 04/21/2014 - 18:00

Estimated please if you can help me because I also need to capture the user form, as in this example page to import fails because this created another version.

Thanks

Submitted by Pierre-yves Monnet on Wed, 04/23/2014 - 18:05

what do you mean exactly ? What's mean "capture the user form" ? What's mean "created another version" ? Please open a different question.

Notifications