Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
the WorkflowManager.processStart method allowed u to set workflow variable.
import java.util.Map; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import org.joget.apps.app.model.AppDefinition; import org.joget.apps.app.service.AppService; import org.joget.apps.app.service.AppUtil; import org.joget.workflow.model.service.WorkflowManager; import org.joget.workflow.model.WorkflowAssignment; import org.joget.workflow.model.WorkflowProcess; public Object execute(WorkflowAssignment assignment, AppDefinition appDef, HttpServletRequest request) { AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService"); WorkflowManager workflowManager = (WorkflowManager) AppUtil.getApplicationContext().getBean("workflowManager"); //get current record id String recordId = appService.getOriginProcessId(assignment.getProcessId()); //get process WorkflowProcess process = appService.getWorkflowProcessForApp(appDef.getAppId(), appDef.getVersion().toString(), "process1"); //set variable Map variables = new HashMap(); variables.put("status", "created"); //start process workflowManager.processStart(process.getId(), null, variables, null, recordId, false); return null; } //call execute method with injected variable return execute(workflowAssignment, appDef, request);
Hi O.o,
thanks for feedback.
It works, I have modified the code to take status based on select box selection instead to have fixed value "Created".
new: variables.put("status","#form.test_send_email.status?java#");
old: variables.put("status", "created");
So the effect is as shown below.
Thanks,
Sylwester
Hi Experts,
In the form I have Select box with 3 different options (Created, Inprogress, Closed) - it's variable workflow "status". .
I'm using Post Processing Tool option after create/update form to run "process1" based on Bean Shell
Programming Guide#UseasProcessTool. - below piece of code.
Unfortunately variable workflow "status" from the form is not visible and is not taken into consideration in the process, which causing process end already at the route point.
The goal is to call a new process after form creation/update which will be sending email based on variable from that form.
APP_test_email-1-20160324232122.jwa