Hi,
I am new to Cube platform and I am still trying to get to grips with the basics so apologies if this is a ‘stupid’ question.
I have a situation where I have created a batch screen and one of the attributes of the batch object is a parent (InputBatch) which I want to the user to select. I have managed to get that working out of the box with no issues.
However I now want to extend that slightly, the batch screen also has an attribute ‘type’. I have added this to the batch in the data model and it is a real object linked via association (many-to-one). This attribute is also present in the parent and to make things easier I do not want the user to have to pick it again, I want to auto assign this when they pick the parent object.
Via the security model I have actually made this field read-only for my data entry user and I have attempted following the standard examples to add code into a middleware service bean that shall assign these values. I am injecting the bean into the edit class (BatchEdit extends AbstractEditor) and calling the bean from the method preCommit().
However when I do this I keep getting the same error: IllegalStateException: Cannot get unfetched attribute [typeS] from detached object
In the Data model I have created a view (again following the examples) and I have added in (ticked) all the parameters for both the parent (including type below it as well) and the type object. I had hoped following from other posts I had read that this would fix but no it did not work.
I then thought it might be better to move this logic to an EntityListener but that made no difference either and I still get the same error.
Can anyone help me or point me in the right direction?
Thanks,
Iain