File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
modules/flowable-form-engine/src
main/java/org/flowable/form/engine/impl/cmd
test/java/org/flowable/form/engine/test Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,10 @@ protected FormInstance resolveFormInstance(CommandContext commandContext) {
242
242
}
243
243
244
244
FormInstance formInstance = null ;
245
- if (taskId != null ) {
245
+ if (formInstanceId != null ) {
246
+ formInstance = formInstances .get (0 );
247
+
248
+ } else if (taskId != null ) {
246
249
if (formInstances .size () > 1 ) {
247
250
throw new FlowableException ("Multiple form instances are found for the same task" );
248
251
}
Original file line number Diff line number Diff line change 18
18
import java .util .Map ;
19
19
20
20
import org .flowable .form .api .FormInstance ;
21
+ import org .flowable .form .model .FormField ;
22
+ import org .flowable .form .model .FormInstanceModel ;
21
23
import org .flowable .form .model .FormModel ;
22
24
import org .joda .time .LocalDate ;
23
25
import org .junit .Test ;
@@ -41,6 +43,13 @@ public void submitSimpleForm() throws Exception {
41
43
JsonNode formNode = formEngineConfiguration .getObjectMapper ().readTree (formInstance .getFormValueBytes ());
42
44
assertEquals ("test" , formNode .get ("values" ).get ("input1" ).asText ());
43
45
assertEquals ("default" , formNode .get ("flowable_form_outcome" ).asText ());
46
+
47
+ FormInstanceModel formInstanceModel = formService .getFormInstanceModelById (formInstance .getId (), null );
48
+ assertEquals ("form1" , formInstanceModel .getKey ());
49
+ assertEquals (1 , formInstanceModel .getFields ().size ());
50
+ FormField formField = formInstanceModel .getFields ().get (0 );
51
+ assertEquals ("input1" , formField .getId ());
52
+ assertEquals ("test" , formField .getValue ());
44
53
}
45
54
46
55
@ Test
You can’t perform that action at this time.
0 commit comments