Field properties

The properties of each field and how they controls the rendering

Each field have a set of properties tells how to render the field. Not all properties are returned all the time since they depend on what type of field it is. The properties are:

  • name: A name of the field that is readable to the user. For example Amount, VAT, Project, Expense Category. This is translated in the supported languages by adding a query parameter lang=en_GB for example.
  • property: The data property the field relates to. This maps to the property found in the expenses endpoints. In case of nested objects is dot-separated like verification.amount.
  • controlType: Defines what type of input field should be rendered, like text, double, list, etc. See details under field types.
  • mandatory: Boolean to indicate if this field is required.
  • visible: Boolean to indicate if the field is visible or not. Only fields with visible=true should be displayed
  • requiresUpdate: Normally any change on a field can be handled on the client side. But if requires update is true it means that if the user changes this field the whole field structure should be posted back to the field endpoint and the returning json should be used to render the view again. As an example when the user selects a different currency then the organization currency we should display the exchange rate field populated with the current exchange rate.
  • value: This property holds the actual value of the input from the user. This should be updated when a field is changed and the type depends on the control type. For example if control type is TEXT the value may have "value" as data. If control type is DOUBLE the value property should have 120.23. If the controls type is LIST the value should have the id from the list object which may be a uuid. And for special types like GUEST_LIST the value property has a special data structure.
  • url: If the control type is LIST the url property is populated with a url pointing to the list content. All lists have the same format regarding of what type of list it is.
  • data: If the control type is LIST, the value will hold the id of the list value object. But for convenience the fields endpoint also returns a data-node which is the object of the selected item in the list. This is done so the client does not have to fetch the list value to display the user readable text behind the id of the list value