0

I have requirement initiate the workflow after submit the form values in the ui level.Means inside the submit listener how to call the workflow and i did all the form values are stored in one object.Now how to i call the workflow,how to send these submitted form values(object) send to the workflow because i want to display these form values in onther form(in UI level).after user approving these,it goes to next user he is also approved then finally complete workflow.

eg:In ui level i create form with the fields username,email,address,mobile etc. finally click submit,after my workflow initiate and approve the data by two level verification by the user(User A,User B).

At the same time i implement code for Inbox,in that inbox i want to display these form values.Whenever user submit the form it goes to inbox,inside inbox i get that approval request,where i approve that one.

Present i created workflow start,user A,user B,end events.Whenever i start process instance flow starts now i displayed which task is running,who is assignee etc from Task service,but i don't know how to pass the submitted form values from ui level to workflow and displayed that data in inbox.

I know through the getVariables() we get all attributes.but how to get from ui to workflow and from workflow to ui?

2 Answers 2

1

First you have instantiate ProcessEngine class as mentioned here :

ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault() .buildProcessEngine();

After that get an instance of RuntimeService as mentioned here:

RuntimeService runtimeService = processEngine.getRuntimeService();

You can create process instance by using following method :

ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("processId");

You need to append all the jars files available inside activiti package to your project libraries.

Sign up to request clarification or add additional context in comments.

2 Comments

First thankx for ur response Joshi,Whatever u given the solution that i already tried.but i want suppose i create one vaadin project in that i created some registration forms ok.I created one more my own Inbox(UI) application through vaadin ok.Now my question is after submit the any registration form,it goes approval to my inbox in that inbox how to i get the submitted regisration form values.I want to display these values into my inbox UI.
@sai576 hope the answer was useful
1

Once you submit your values, it goes to next level in the process diagram. So here a new taskId will be created. Here's the code which used Java APIs provided by Activiti to get the form properties :

FormService formService = processEngine.getFormService();
TaskService taskService1 = processEngine.getTaskService();
TaskQuery taskQuery1 = taskService1.createTaskQuery().taskAssignee("gonzo");
List<Task> taskList1 = taskQuery1.list();
int j = 0;
for(Task task : taskList1){
    j++;
TaskFormData taskFormData = formService.getTaskFormData(task.getId());
List<FormProperty> listFormProperty = taskFormData.getFormProperties();
for(FormProperty formProperty : listFormProperty){
       out.println(task.getId()+":"+task.getName()+"id:"+formProperty.getId());
       out.println(task.getId()+":"+task.getName()+"name:"+formProperty.getName());
       out.println(task.getId()+":"+task.getName()+"type:"+formProperty.getType().getName());
       out.println(task.getId()+":"+task.getName()+"value:"+formProperty.getValue());

    }

    out.println("task "+j+"is "+task.getId()+":"+task.getName()+":"+task.getAssignee()+":"+task.getDescription());
}

Above code helps you to get all the form properties like type, name, value and many more.

Also the same properties you can achieve through REST API provided by Activiti. Here's the Form properties API.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.