Get all fields of a given type


How can I get all fields of a given type?
I need the fields name to use them as header in an export to CSV file.

Export job fails with OutOfMemoryError

You can use the Type#fieldTypes function to retrieve all fields defined on a type.

In JavaScript, it would look like this:

MyType.fieldTypes().map(function(fieldType) { return; });

Where C3.typesys.Type#fieldTypes returns an array of C3.typesys.FieldType instances. Keep in mind that a field can be a method as well.

1 Like

Thanks @matt, but how I can check if a field is a method or not? because I only want fields!


Check out the documentation for C3.typesys.FieldType:

Hint: At minimum, a field type consists of a name (the field name) and a value type. You’ll have to figure out how to determine if a value type is a method.


There is FunctionType, how I can get these instances? because I can then filter out these functions from my fields list.


The solution is as described bellow

MyType.fieldTypes().filter(function(fieldType) {
  var fn =;
  var vt = fieldType.valueType();
  return !vt.isAnyFunction();
}).map(function(fieldType) {
Is there a programmatic way to determine the data type of a specific field?

Following up on this with a twist, what if I wanted all fields on my Type that are writable?


define “writable” please


If I did a MyType.upsert(), the fields I am allowed to define. e.g. not stored calcs, not functions, not foreign key lookups, etc.