On start up the module will validate that the structure of the ViewModel matches the FormDefinition structure of the form. This is also done for the submission structure of the form. If not an error message will be printed in the logs.
The View Model is used for start-form and user-task forms scenarios. When CamundaTask is not null the form is a user-task form, otherwise it is a start-form.
ViewModel example:
data class Address(
val street: String,
val houseNumber: String,
val zipCode: String
)
data class Person(
val firstName: String,
val lastName: String,
val fullName: String = "$firstName $lastName",
val age: Int,
var personalAddress: Address? = null
) : ViewModel {
override fun update(task: CamundaTask?): ViewModel {
// code to update the ViewModel
return this
}
}