Detail
#26797
Transaction with user input: invisible properties of the form model cannot be assigned values (initialized)
Background
In a "transaction with user input", the user input (for form definition, which values should the user be able to enter) is described as a separate model type. In the "Initialization" this model type is filled with values from the target model (fields are preset).
Now, during "Initialization", you may want to store additional information on this model type for the form definition, which should not be displayed to the user and should also not be entered by the user: For example, certain properties of the target model are to be stored on the form object during "initialization" in order to use them in a constraint on the form model to "check" later user input or to annotate "value suggestions" for it.
Problem
Such attributes that are not displayed in the user input form (either not part of the form or declared as "hidden") cannot be assigned values in the expression for "initialization":
Caused by: java.lang.IllegalStateException: Attribute 'tl.contract.offer:OfferStateChangeForm#permittedValues' cannot be modified. at com.top_logic.element.meta.form.overlay.FormObjectOverlay.tUpdate(FormObjectOverlay.java:449) at com.top_logic.model.search.expr.DynamicSet.eval(DynamicSet.java:92) at com.top_logic.model.search.expr.GenericMethod.internalEval(GenericMethod.java:107) at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95) at com.top_logic.model.search.expr.SearchExpression.eval(SearchExpression.java:54) at com.top_logic.model.search.expr.Block.internalEval(Block.java:43) at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95) at com.top_logic.model.search.expr.Lambda.internalEval(Lambda.java:82) at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95) at com.top_logic.model.search.expr.Call.internalEval(Call.java:57) at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95) at com.top_logic.model.search.expr.Lambda.internalEval(Lambda.java:82) at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95) at com.top_logic.model.search.expr.Lambda.internalEval(Lambda.java:82) at com.top_logic.model.search.expr.SearchExpression.evalWith(SearchExpression.java:95) at com.top_logic.model.search.expr.query.DirectQueryExecutor.executeWith(DirectQueryExecutor.java:62) at com.top_logic.model.search.expr.query.QueryExecutor.execute(QueryExecutor.java:227) at com.top_logic.model.search.providers.MonomorphicCreateFormBuilderByExpression.fillFormContext(MonomorphicCreateFormBuilderByExpression.java:99)
This was classified as a bug after initial consultation.
Test
- /com.top_logic.demo/src/test/java/test/com/top_logic/demo/scripted/layout/transaction/TestCustomTransaction.script.xml