Dynamic and large content in user tasks forms

Hi there, I’ve made some good advertising for Camunda, and it was decided that I should replace an existing software with Camunda.

In this software, at a certain point a mail was sent to a user; and to this mail a csv file was attached. The user had to fill in some values in the csv file and send it back to the application. When I was informed of this process, I immediately said “We can have it easier with a user task”.

Now the project has started, and things are getting serious. And now I was informed that the csv file contains about 200 rows, and that its content is dynamic. Has anybody an idea how I can fill a user form dynamically? I was already thinking of a workaround to let the user download the user task from the task form and upload it again. But that is really a very ugly solution.

Thanks in advance for good ideas!

Regards,
Christian

Can you explain more about what dynamic means?

Hi Stephen, with “dynamic” I mean that the number and content of the input fields may vary as well. For example in one case there are 200 fields, and the last two fields are “price” and “amount”, in other cases there may be 198, and the last two fields are “energy” and “power”.

You could add a angular component that is a spreadsheet style format and have them fill it in.

Hi,

My suggestion would be to become json document centric. If you store the json document as a process variable, its really easy to render in forms etc. The json document becomes the model and the form can use angular directives to build quite a dynamic form…

If you avoid the csv, hat would be easier, if not, you may want to create a csv-json and json-csv library/task…

regards

Rob

Hi @Webcyberrob and StephenOTT. Thanks for your ideas. But I’ve got a further question: if I used a jsonized variable for 200 entries, its String presentation might become pretty large. And because a variable delivered to a task form can not be transient, I suspect that it might easily violate the maximum of 4000 characters. Or do I walk on a false track?

once more thanks a lot
Christian

Hi Christian, a Jason variable can be treated as an object and thus stored as a serialised object. Technically this will be stored as a byte array and thus will not be constrained by the max string size…

Regards

Rob

Hi all, the json approach with Angular ng-statements did the job. The table is filled really nicely.

However, now I have the next problem: some of the fields in the table are editable. And when I want to read what the user has changed, I get this exception:

context [ttp-nio-8080-exec-10] ENGINE-16004 Exception while closing command context: Cannot deserialize object in variable 'manuelle_bepreisung': SPIN/JACKSON-JSON-01006 Cannot deserialize '{"entries"...' to java type '[simple type, class com.innogy.flink.pricing.vpf.entity.individual.IndividualBepreisung]'
org.camunda.bpm.engine.ProcessEngineException: Cannot deserialize object in variable 'manuelle_bepreisung': SPIN/JACKSON-JSON-01006 Cannot deserialize '{"entries"...' to java type '[simple type, class com.innogy.flink.pricing.vpf.entity.individual.IndividualBepreisung]'
	at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:85) ~[camunda-engine-7.12.0.jar:7.12.0]
	at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:31) ~[camunda-engine-7.12.0.jar:7.12.0]
	at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getTypedValue(TypedValueField.java:96) ~[camunda-engine-7.12.0.jar:7.12.0]
	at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.getTypedValue(VariableInstanceEntity.java:269) ~[camunda-engine-7.12.0.jar:7.12.0]
	at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getValueFromVariableInstance(AbstractVariableScope.java:146) ~[camunda-engine-7.12.0.jar:7.12.0]
	at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.getVariable(AbstractVariableScope.java:133) ~[camunda-engine-7.12.0.jar:7.12.0]

... many skipped

Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "$$hashKey" (class com.innogy.flink.pricing.vpf.entity.individual.Entry), not marked as ignorable (3 known properties: "value", "name", "secondValue"])
 at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.innogy.flink.pricing.vpf.entity.individual.IndividualBepreisung["entries"]->java.util.ArrayList[0]->com.innogy.flink.pricing.vpf.entity.individual.Entry["$$hashKey"])
	at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:840)
	at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1206)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1592)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1570)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4173)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2536)
	at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper.mapInternalToJava(JacksonJsonDataFormatMapper.java:98)
	... 253 more

When I asked Mr Google about $$hashKey, it turned out to come out of Angular. With this, Angular manages what value were changed, see here: https://stackoverflow.com/questions/18826320/what-is-the-hashkey-added-to-my-json-stringify-result . Does anybody know how I can tell Camunda to use angular.toJson(obj) instead of JSON.stringify(obj) ?

okay, I found it out: in the html form, do not use

<tbody ng-repeat="e in myArray">

but use instead

<tbody ng-repeat="e in myArray track by $index">

:+1:

1 Like