-
Notifications
You must be signed in to change notification settings - Fork 2.6k
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST /runtime/tasks/{taskId} #1471
Comments
When using the complete task action REST API, it will complete the task and set the variables, but not create a form instance of a submitted form. For that you will need to do another call as well to the Flowable Form Engine REST API: The Flowable Task application uses the completeTaskWithForm method in the TaskService, but this method is not yet exposed via the REST API. This needs to done in the Task action REST API with another action value like completeWithForm. |
POST form/form-instances:
data-3.json:
Returns:
However, if you navigate to the Tasks tab in the Flowable Task app's dashboard it doesn't show the completed task's form data: Is this the expected behaviour? BTW, the In the Form Users Guide form/form-instances the Request body example is incorrect:
For example:
See: Flowable-Rest/ Forms API (POST form/form-instances) gives JSON parse error |
In your example post you left out the taskId and processDefinitionId properties, where the taskId property is the most important one because this connects the form instance to the completed task. Thanks for pointing to the incorrect payload mentioned in the Forms Engine REST API docs, this has been corrected now. |
See: Flowable examples (includes the example curl scripts, sample JSON payloads and the sample HR App BAR and ZIP files) GET /runtime/tasks
Returns:
POST /runtime/tasks
Returns:
POST /form/form-instances
I have updated the POST body (data-3.json) as follows:
Where (using the values returned from GET /runtime/tasks)
Are these correct? Returns:
As before, if you navigate to the Tasks tab in the Flowable Task app's dashboard it doesn't show the completed task's data in the form. |
We have added support to get a start and task form in the REST API and allow to start a process instance with a form and complete a task with a form. This should solve the issues mentioned in this issue. Get process definition start form:
Start a process instance with a form
Get a Task form:
Complete a Task form:
|
As discussed in this post I'm happy to use the Flowable Modeler to model business processes and to create tasks and process instances, however, I'd like to use Flowable's REST API to interact with process instances: In my initial comments I noted that POST [/runtime/tasks/{taskId} doesn't appear to save the variables in the JSON payload:
My understanding that this is the case is based on trying to view the 'completed' task in the Flowable Task App. As you suggested I then tried to create a form instance (which would mean that the 'completed' task would appear with the variables values populated (i.e., not empty) in the Flowable Task App). POST /form/form-instances
Which despite returning 200 (OK) doesn't show the completed task's data in the form: Note: POST form/form-data appears to complete the User task, save the variables in the JSON payload and the 'completed' task appears with the variables values populated (i.e., not empty) in the Flowable Task App: |
Did you try the new REST API service I mentioned in my previous comment on this issue? The POST to the runtime/tasks/{taskId} does exactly what you are expecting. You only have to provide the formDefinitionId as an additional property in the JSON payload. |
I'm using the latest flowable/all-in-one Docker image.
POST runtime/tasks
I added the
It returns 200 (OK) but the Flowable Task App doesn't show the completed task's variables (i.e., not empty) in the form. See: Flowable examples (includes the example curl scripts, sample JSON payloads and the sample HR App BAR and ZIP files), |
The changes I mentioned in the issue comment are done on the latest master version, so they are not yet available as part of a Flowable release. There will be a 6.4.1. release coming in the new year. |
OK, great thanks :) |
@tijsrademakers I tested the latest source code, |
@xcaptain thanks for testing. Yes the runtime endpoint only works active tasks. I'll make sure to add support in the /history/tasks/{taskId}/form REST service as well. |
@tijsrademakers I'm using
to get form data from a task whatever it's active or completed, other fields works fine, but for
can return the correspond attachment id for the Is this a bug or there are any other ways to get the value of a |
@xcaptain the history REST services have been added now. |
@tijsrademakers Thank you for the quick update, I tested the latest source, the history task form api returns 404 as follows: As to the upload field, I'm first using the content api to upload a file, as defined in https://github.com/flowable/flowable-engine/blob/master/docs/public-api/references/openapi/content/flowable-oas-content.yaml#L282
then use the result content item id as upload field value. Then I use:
to filter all attachment in the task. |
@xcaptain there are unit tests testing the retrieval of a historic task instance form, so maybe you can do some more debugging/testing to see what is happening? The DefaultFormFieldHandler handles the submit and retrieval of the content items connected to an upload field. Can you check if a process variable is created with the upload field id? Maybe you can also debug the DefaultFormFieldHandler to see what is happening exactly. |
A minor fix related to this issue. #1543 |
Yes, ( I used Flowable Task to create a process instance. Then:
For example, GET runtime/tasks
Output:
GET runtime/tasks/{formId}/form
Output:
data-7.json:
POST runtime/tasks
Output:
|
See: Flowable examples (includes the example curl scripts, sample JSON payloads and the sample HR App BAR and ZIP files) |
I checked the Open API Specification V3 for the Process API.
If I remove "formDefinitionId" (and "outcome") from the For example: Completed: However, if you navigate to the Tasks tab in the Flowable Task app's dashboard it doesn't show the completed task's form data: |
Also: GET runtime/tasks/{formId}/form returns POST runtime/tasks/{taskId} accepts Output:
|
After a bit more trial and error I got it to work :) Sample payload:
Also: GET runtime/tasks/{formId}/form returns "type": "text" Output:
And: GET runtime/tasks/{formId}/form returns:
POST runtime/tasks/{taskId} accepts:
Output:
|
Using Flowable's REST API to complete a User task:
data-1.json:
Returns:
Despite returning OK it doesn't appear to save the User task's form data:
See: https://robferguson.org/blog/2018/12/24/flowable-rest-api-part-1/
The text was updated successfully, but these errors were encountered: