How to redirect to process first human task from application page?
Another question, I have an application page and i also have data to edit, and i cant do that easily in the instantiation form. So i put the editing in the first human task, but this way the user cant get from application page to this task in one click. Is there a way to do this? One link/button click and redirect to first task in the process? (process with no instantiation form)
It is doable but not native in Bonita as processing of form submission is asynchronous.
When user submit the process instantiation form, the submit button widget call Bonita Engine REST API to ask for creation of a new process instance (using the process definition related to the instantiation form). The answer of the REST API call is the new process instance id.
If you create a custom widget to start the process instance, you can:
- perform such as call
- store the process instance id received in the response
- use the process instance id and the user unique id to find if pending task are available for the user in the newly created process instance (need to do some polling due to asynchronous behavior)
- once task is identified do the redirection to display the task form
This is more or less what has been done in a community contribution. Note that this contribution has not been updated in a while and has open issues but it can still be useful for inspiration.
A probably easier solution would be to figure out how to do the edition of the data (I guess a business variable) in the instantiation form. Using API and search query you should be able to get the business data value, allow edition in the form and send the data to the process using process instantiation contract.