I'm creating a small "expenses" style project as part of my learning. (I know there's an app in the app store for this, but I'm creating this for my own education; and the demo app doesn't seem to do what I'm trying to achieve. My goal: There are various expense categories (flight, meal, hotel, ...) Each category has a default value, e.g. each flight has a default price of £120. When a user selects the expense category, an expense item is created. The expense item's value defaults to that for its category The user can override the default in the expense item, e.g. set flight price to £90. I can't see a way to specify a calculated default. The Value itself can be calculated, but then it's read-only so can't be overridden. And the "Default" value input doesn't support deriving the value; it needs to be hard coded. Any suggestions on how to do this? I'm thinking it should be possible to use a microflow to populate the default. Is that right? Any other suggestions? Thanks.
You can setup a config entity in which you specify the prices for the expense categories.
When creating an expense retrieve the price with a microflow and allow the user to modify the price field.
This way you have a default that can be overridden by the user and maintained while the app is running.
Erwin 't Hoen
I suggest you create a configuration entity in which you configure your categories and their default values. So that entity would have two attributes:
Then a second entity which the user is creating with an association to the category. And an attribute with the price. This price will be the manual price. A third attribute can be used as a calculated value. The microflow filling that value will check if a manual price has been entered, if so then it will render that price, otherwise the price from the associated category.
You could also just copy the category price into the manual price field and always just show that.
I seem to have just posted right after Erwin said the same thing in less words :)