Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
Code Block | ||
---|---|---|
| ||
import java.util.ArrayList; import java.util.Collection; import org.joget.apps.app.service.AppUtil; import org.joget.directory.model.User; import org.joget.directory.model.service.ExtDirectoryManager; import org.joget.workflow.model.WorkflowActivity; public Collection getAssignees(WorkflowActivity activity) { Collection assignees = new ArrayList(); ExtDirectoryManager directoryManager = (ExtDirectoryManager) pluginManager.getBean("directoryManager"); String deptId = "D-005"; //Get total user in department Long total = directoryManager.getTotalUsers(null, null, deptId, null, null, null, null); //Get random number from 0 to the total number of users in department int random = (int) (Math.random() * total); //Get users using directory manager Collection userList = directoryManager.getUsers(null, null, deptId, null, null, null, null, "firstName", false, random, 1); for(Object u : userList){ User user = (User) u; assignees.add(user.getUsername()); } return assignees; } //call getAssignees method with injected variable return getAssignees(workflowActivity); |
Anchor | ||||
---|---|---|---|---|
|
...