Class CustomField

Represents meta information about a document-level custom field, such as the display label name, the internal name, its data type, or additional help text.

var api = new TVS.Api();
api.login('username', 'password').then(function() {
    // get container results...
    return api.retrieveDocumentContainer(containerId);
}).then(function(application) {
    var doc = application.Documents[0];

    // custom document fields
    console.log('has custom fields:', doc.hasCustomFields());
    console.log('custom field values:', doc.getCustomFieldValues());
    console.log('custom fields (display):', doc.getCustomFieldValuesDisplay());

    // accessing meta information (including value)
    for (var i = 0; i < doc.CustomFields.length; i++) {
        var field = doc.CustomFields[i];
        console.log('display name:', field.DisplayName);
        console.log('internal name:', field.PropertyName);
        console.log('value:', field.getValue());
        console.log('isTextField:', field.isTextField());
        console.log('isDateField:', field.isDateField());
        console.log('isDropDownField:', field.isDropDownField());
        console.log('hasHelp:', field.hasHelp());
        if (field.hasHelp()) console.log('help:', field.Help);
        if (field.isDropDownField()) console.log('allowed values:', field.getValues());
    }
});
class CustomField()

Represents meta information about a document-level custom field.

Constant Properties

CustomField.DATA_TYPE_STRING

Represents the string data type for a custom field.

CustomField.DATA_TYPE_EXPIRY_DATE

Represents the expiry date data type for a custom field.

CustomField.DATA_TYPE_DROP_DOWN

Represents the enum data type for a custom field, where an operator may choose from a set of available options.

Properties

CustomField.PropertyName

Provides the internal name of the custom field. The internal name is used to construct document-level field values.

CustomField.DisplayName

Provides the display label name of the custom field that can be used to present the name of the field to operators.

Help

Provides help text information that describes the purpose of the custom field to operators of the system.

DataType

Represents the internal data type of the custom field, which is CustomField.DATA_TYPE_STRING, CustomField.DATA_TYPE_EXPIRY_DATE or CustomField.DATA_TYPE_DROP_DOWN.

Index

Provides the internal data slot that is used to store the custom field data against a document. There are 10 slots available, 0 to 9. This field also dictates the order in which custom fields are provided.

Required

true, if the custom field is a mandatory field; otherwise false.

Value

The value of the custom field for the corresponding document.

Values

Represents the list of available options operators can choose from in case this custom field represents a drop-down field.

Methods

isTextField()

true if this custom field is a text field.

isDateField()

true if this custom field is a date field.

isDropDownField()

true if this custom field is a drop-down field.

hasHelp()

true if this custom field has additional help text available.

getValue()

Returns the current value of this custom field for the corresponding document.

getValues()

Returns a list of available options, operators can choose from in case this custom field is a drop-down field.

getDisplayName()

Return the display label text for this custom field.

getDisplayValue()

Return the current value of this custom field is a human-readable format.

encodeValue(value)

Sets the given value as the new value of this custom field and encodes the value accordingly to the data type of the custom field.

Arguments
  • value (object()) – The new value of the custom field.