# How To Get Form Variables Data After Submitting The Form?

**URL:** https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153
**Category:** Flowable Engine
**Created:** [July 19, 2021, 9:34am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153 "2021-07-19T09:34:23Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Salman](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Salman](https://forum.flowable.org/u/Salman)
#### Post date: [July 19, 2021, 9:34am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/1 "2021-07-19T09:34:23Z")

</div>

I am using flowable REST apis for creating task and getting its form and submitting it. After the completion of the form, I unable to find a way to get the form and also get its value field filled with data that I have submitted.

To get the idea of work flow , I pasting following endpoints according to right sequence to understand its flow.

1. **To get Task ID for the respective form** : mmn-runtime/tasks?caseInstanceId={{case\_instance\_id}}

2. **To get form of the new task id** : cmmn-api/cmmn-runtime/tasks/{{task\_id}}/form

3. **Performing a POST request to send the data variables of the form** : form-api/form/form-instances

4. **Performing POST request to submit form with action=complete** : cmmn-api/cmmn-runtime/tasks/{{task\_id}}

After completing the form with action=complete, I need to get all those variables of the form field.

I searched from the doc there is many of these similar thing but not exactly what I am looking for.  
Is there any endpoint already present that will fulfill my requirement?

---

<div class="post-metadata">

### Author: ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)
#### Post date: [July 19, 2021, 11:57am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/2 "2021-07-19T11:57:16Z")

</div>

Hi,

If you want to fetch the complete form (a historic task instance with the populated form) you can use this endpoint;

bpmn;  
`process-api/history/historic-task-instances/{taskId}/form`

or  
cmmn;  
`cmmn-api/cmmn-history/historic-task-instances/{taskId}/form`

Does this help?

Regards,

Yvo

---

<div class="post-metadata">

### Author: ![Salman](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Salman](https://forum.flowable.org/u/Salman)
#### Post date: [July 19, 2021, 1:07pm UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/3 "2021-07-19T13:07:43Z")

</div>

Hello,

Thanks for the help first of all.  
And yeah I have tried these ones but it is saying task ID does not exist and when I check from history tables they all are empty.

---

<div class="post-metadata">

### Author: ![Salman](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Salman](https://forum.flowable.org/u/Salman)
#### Post date: [July 23, 2021, 6:48am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/4 "2021-07-23T06:48:08Z")

</div>

@yvo , we have mark the form complete that is action=complete in the body of the post request of:

1. cmmn-runtime/tasks/{{task\_id}}

When we are using those above provide API call for historical we are getting an error that is provided task\_id doesnot exist and also when we check historical tables from database that whole tables are empty.

Is there any other steps that is missing ? that is required to populated that historical table other than markng submitting form action=complete with its respective task\_id

---

<div class="post-metadata">

### Author: ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)
#### Post date: [July 23, 2021, 7:26am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/5 "2021-07-23T07:26:11Z")

</div>

Are you sure you’re looking in the right place?  
When creating a task an entry is written both in the `ACT_RU_TASK` and in the `ACT_HI_TASKINST`. But; with only a `start time` and no `end time`.  
When completing; the entry is removed from `ACT_RU_TASK` and the entry in `ACT_HI_TASKINST` is updated with an `end time`.

The complete REST call seems correct.  
Something seems to be off creating the task.

Regards,

Yvo

---

<div class="post-metadata">

### Author: ![Salman](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Salman](https://forum.flowable.org/u/Salman)
#### Post date: [July 23, 2021, 8:10am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/6 "2021-07-23T08:10:47Z")

</div>

@yvo,

if something is missing in creating task, following are the steps for creating task:

**Getting latest case definition ID** : cmmn-repository/case-definitions?key=risk-case&latest=true

**Performing a post request in getting a new case\_instance\_ID by giving it case\_def\_ID** : cmmn-runtime/case-instances

**Giving this case\_instance\_ID for getting task\_ID** : cmmn-runtime/tasks?caseInstanceId={{case\_instance\_id}}

And then rest steps are mentioned above for getting form, etc using that task\_ID.

---

<div class="post-metadata">

### Author: ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)
#### Post date: [July 23, 2021, 8:27am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/7 "2021-07-23T08:27:48Z")

</div>

What is the result of getting the task?

---

<div class="post-metadata">

### Author: ![Salman](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Salman](https://forum.flowable.org/u/Salman)
#### Post date: [July 23, 2021, 8:31am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/8 "2021-07-23T08:31:02Z")

</div>

It is in below format:  
{  
“data”: [  
{  
“id”: “8”,  
“url”: “[http://localhost:8182/cmmn-runtime/tasks/8](http://localhost:8182/cmmn-runtime/tasks/8)”,  
“owner”: “owner”,  
“assignee”: “kermit”,  
“delegationState”: “pending”,  
“name”: “My task”,  
“description”: “Task description”,  
“createTime”: “2013-04-17T10:17:43.902+0000”,  
“dueDate”: “2013-04-17T10:17:43.902+0000”,  
“priority”: 50,  
“suspended”: true,  
“claimTime”: “2018-04-17T10:17:43.902+0000”,  
“taskDefinitionKey”: “theTask”,  
“scopeDefinitionId”: “123”,  
“scopeId”: “123”,  
“subScopeId”: “123”,  
“scopeType”: “cmmn”,  
“propagatedStageInstanceId”: “123”,  
“tenantId”: “null”,  
“category”: “ExampleCategory”,  
“formKey”: “string”,  
“caseInstanceId”: “5”,  
“caseInstanceUrl”: “[http://localhost:8182/cmmn-runtime/case-instances/5](http://localhost:8182/cmmn-runtime/case-instances/5)”,  
“caseDefinitionId”: “oneTaskCase%3A1%3A4”,  
“caseDefinitionUrl”: “[http://localhost:8182/cmmn-runtime/case-definitions/oneTaskCase%3A1%3A4](http://localhost:8182/cmmn-runtime/case-definitions/oneTaskCase%3A1%3A4)”,  
“parentTaskId”: “null”,  
“parentTaskUrl”: “null”,  
“executionId”: “123”,  
“processInstanceId”: “123”,  
“processDefinitionId”: “123”,  
“variables”: [  
{  
“name”: “myVariable”,  
“type”: “string”,  
“value”: “test”,  
“valueUrl”: “http://…”,  
“scope”: “string”  
}  
]  
}  
],  
“total”: 0,  
“start”: 0,  
“sort”: “string”,  
“order”: “string”,  
“size”: 0  
}

And then I used ID as task\_ID for further api call.

---

<div class="post-metadata">

### Author: ![Salman](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Salman](https://forum.flowable.org/u/Salman)
#### Post date: [July 23, 2021, 8:40am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/9 "2021-07-23T08:40:16Z")

</div>

@yvo

One thing I have noticed is that when I create new task **ACT\_RU\_TASK** get that task\_id with no end\_time whiling **ACT\_HI\_TASKINST** is empty doesnot contain any.

But when I complete form by sending action= **complete** it removes that entry from **ACT\_RU\_TASK** but **ACT\_HI\_TASKINST** is still empty.

I think there is some step missing in getting history populated.

---

<div class="post-metadata">

### Author: ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)
#### Post date: [July 23, 2021, 8:44am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/10 "2021-07-23T08:44:55Z")

</div>

Do you have history disabled?

`flowable.history-level=none` ?

---

<div class="post-metadata">

### Author: ![Salman](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Salman](https://forum.flowable.org/u/Salman)
#### Post date: [July 23, 2021, 9:41am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/11 "2021-07-23T09:41:53Z")

</div>

@yvo where is this file located in which this line is located, is the a config file?

Can you share its location?

---

<div class="post-metadata">

### Author: ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)
#### Post date: [July 23, 2021, 10:00am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/12 "2021-07-23T10:00:55Z")

</div>

Depends on how you run Flowable.  
It’s a property. This can set in various ways.  
But this is not the default value. So if this is set; then it’s done explicitly.  
For example in a `application.properties` file. Or passing it as command line arguments to the runnable war. Or as environment variables when running the Docker container… etc etc

> **[Spring Boot · Flowable Open Source Documentation](https://flowable.com/open-source/docs/bpmn/ch05a-Spring-Boot/#flowable-application-properties)**
>
> Spring Boot is an application framework which, according to \[its website\](http://projects.spring.io/spring-boot/), \*makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". It takes an opinionated view...

---

<div class="post-metadata">

### Author: ![muhammadshoaib-10p](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/muhammadshoaib-10p/32/2491_2.png) [@muhammadshoaib-10p](https://forum.flowable.org/u/muhammadshoaib-10p)
#### Post date: [July 26, 2021, 9:50am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/13 "2021-07-26T09:50:57Z")

</div>

Hey @yvo, Thank you for the help. Now the history tables have data.

Just tell me one thing how would I get the form values. Suppose the user has 10 fields on the form. It just only filled 2 of those and marked them as complete and jump on to the 2nd form. So for some reason, the user has to go back and edit the 1st form again.

So for the above case, we need two things first the values of the 2 fields which he had filled previously and how we update that previously filled form value?

Please post the rest API because we are using the rest API’s for flowable.

---

<div class="post-metadata">

### Author: ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)
#### Post date: [July 26, 2021, 10:24am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/14 "2021-07-26T10:24:29Z")

</div>

‘just going back’ is something that in most cases you either have to explicitly model in your process model.  
Or you have to do some technical things. But it’s not a default case.  
Escalation or verification is. In that case you model this step (user task with form) and populate the form assigned to the ‘second’ second step with the values of the ‘first’ completed step.

Also; Flowable UI provides the option to save a form. Perhaps this is something that could be used. Take a look at Flowable UI (and the corresponding backend code).

Yvo

---

<div class="post-metadata">

### Author: ![muhammadshoaib-10p](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/muhammadshoaib-10p/32/2491_2.png) [@muhammadshoaib-10p](https://forum.flowable.org/u/muhammadshoaib-10p)
#### Post date: [July 26, 2021, 10:56am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/15 "2021-07-26T10:56:45Z")

</div>

flowable-rest/cmmn-api/cmmn-history/historic-case-instance/{{task\_id}}/form

I am calling this API to get the form values it only returns me the form value when the task is not completed. After I marked it complete. It returns me null in form value.

Can you suggest me the form API to get that form value when the task is complete?

Thank you.

---

<div class="post-metadata">

### Author: ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)
#### Post date: [August 2, 2021, 11:59am UTC](https://forum.flowable.org/t/how-to-get-form-variables-data-after-submitting-the-form/8153/16 "2021-08-02T11:59:18Z")

</div>

> [@muhammadshoaib-10p](#):
>
> flowable-rest/cmmn-api/cmmn-history/historic-case-instance/{{task\_id}}/form

Do you mean /historic-task-instances/ instead of case-instance?

Looking at the code here [https://github.com/flowable/flowable-engine/blob/master/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricTaskInstanceResource.java#L94](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricTaskInstanceResource.java#L94)

It should give you data back, as it fetches the historical counterpart: [https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormModelCmd.java#L67](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormModelCmd.java#L67)

What does that endpoint return? A 404? Something else?
