Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi,
-You can use "BeanShell Form Binder"
-After setting up the user's info, you can use the BeanShell script below and modify it to your convenience.
Script:
import java.util.Collection; import org.joget.apps.app.service.AppUtil; import org.joget.apps.form.model.Element; import org.joget.apps.form.model.FormData; import org.joget.apps.form.model.FormRow; import org.joget.apps.form.model.FormRowSet; import org.joget.apps.form.service.FormUtil; import org.joget.directory.model.User; import org.joget.directory.model.service.ExtDirectoryManager; public FormRowSet load(String[] values) { FormRowSet rows = new FormRowSet(); ExtDirectoryManager directoryManager = (ExtDirectoryManager) AppUtil.getApplicationContext().getBean("directoryManager"); //set groupId based on dependency value String groupId = "G-004"; if (values != null && values.length > 0) { groupId = values[0]; } //Get users using directory manager Collection userList = directoryManager.getUsers(null, null, null, null, groupId, null, null, "firstName", false, null, null); for(Object u : userList){ User user = (User) u; FormRow option = new FormRow(); option.setProperty(FormUtil.PROPERTY_VALUE, user.getUsername()); option.setProperty(FormUtil.PROPERTY_LABEL, user.getFirstName() + " " + user.getLastName() + " " + user.getEmail()); rows.add(option); } return rows; } //call load method with injected variable return load(values);
Output Preview:
See Bean Shell Programming Guide#Usages for more information. Thank you
I had copy this code on the form
but I don't get any user email from the external directory
Thanx in advance
Check the group id for your users in the external directory. Provide that group id in the variable "String groupId =
"G-004". THank you
Or set "String groupId =
"null"
;.Thank you
I want User email From The External directory
![](/community/download/attachments/229901940/image2023-1-12_12-22-34.png?version=1&modificationDate=1673506381000&api=v2)
I only Get user name and full name
is There any option to get user email from the external directory