Setting an Initial Value for an Associated Entity in a Dropdown

How can I set the initial value of a dropdown from an associated entity?

While there are many options, in my case the initial value should always be “Invoice”. I was reading the documentation and it discusses many ways t do this, but I am unsure of the method I should use. There does not seem to be a “Initial Value” option anywhere in Cuba Studio in the Data Model or UI section.

On a side note, this would be a great add for Cuba Studio as it continues on its path to require users to spend more time in Cuba Studio and less time in the IDE for basic things like this.

Thanks in advance!

I’d recommend using the initNewItem() method of your screen controller, it’s explained here. So you should load your Invoice entity using DataManager and set it to the corresponding attribute of the newly created entity.

As for ability to set initial values declaratively in the data model - I agree, it’s a good idea. Please vote here: https://www.cuba-platform.com/discuss/t/default-value-in-defining-entity