Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
Bulk create users based on the grid data.
...
Randomly assign an a user in a department to a workflow activity.
...
Code Block | ||
---|---|---|
| ||
import org.joget.apps.form.model.FormRow; import org.joget.apps.form.model.FormRowSet; import org.joget.apps.app.service.AppUtil; import org.joget.plugin.base.PluginManager; import org.joget.apps.form.model.FormLoadBinder; import org.joget.workflow.model.service.WorkflowManager; String formDefId = "ExpensesClaimEntry"; //change this to the form id used to load grid data String foreignKey = "claim"; //change this to the foreign key field id // Reuse Multi Row Binder to load data PluginManager pluginManager = (PluginManager) AppUtil.getApplicationContext().getBean("pluginManager"); WorkflowManager workflowManager = (WorkflowManager) AppUtil.getApplicationContext().getBean("workflowManager"); FormLoadBinder binder = (FormLoadBinder) pluginManager.getPlugin("org.joget.plugin.enterprise.MultirowFormBinder"); //Load from the grid table binder.setProperty("formDefId", formDefId); binder.setProperty("foreignKey", foreignKey); FormRowSet rows; rows = binder.load(null, "#assignment.processId#", null); //loop through records returned for (FormRow row : rows) { try { Map variableMap = new HashMap(); variableMap.put("status", row.getProperty("purpose")); //start a new process instance with data from each row //processStart(String processDefId, String processId, Map<String, String> variables, String startProcUsername, String parentProcessId, boolean startManually) workflowManager.processStart("expenseclaim:latest:process1", null, variableMap, null, row.getProperty("id"), false); } catch (Exception e) {} } |
Decide to approve or reject a request based on the value of the workflow variable "status".
Code Block | ||
---|---|---|
| ||
import org.joget.workflow.model.DecisionResult;
//Transition Name to go to
String transitionApprove = "approve";
String transitionReject = "reject";
//Workflow variable ID to set
String workflowVariable = "status";
DecisionResult result = new DecisionResult();
/* Bean Shell Decision supports hash variable, and has access to the process instance context. */
//System.out.println("Value of \'status\' wf-var in this process instance is: " + "#variable.status#");
if ("yes".equalsIgnoreCase("#variable.status#")) {
result.addTransition(transitionApprove);
result.setVariable(workflowVariable, "ApprovedByBeanShellDecision");
} else {
result.addTransition(transitionReject);
result.setVariable(workflowVariable, "RejectedByBeanShellDecision");
}
/* For use cases requiring multiple node routing, do set boolean below as true. */
//result.setIsAndSplit(true);
return result; |
Check the user is in a group and is an admin user.
...