Get DB Field Label Programmatically

Is it possible to get the label of a field in the data model via JS? Something like DB.modelname.labelOf(fieldName). This would be very helpful for a lot of cases e.g. table column headers.

Give this a try:

DB.schema.objects["purchase_request"].attributes.unit.label

(replace “purchase_request” with the name of your model, and “unit” with the name of your field)

You can explore the DB namespace in the debug console in the desktop or web container, the autocomplete is pretty good.