Retrieving the list of customFields enabled for an expense nature
Custom fields activation depends on the expense nature. For example, custom field “Bill back client (bool)” may be activated for travel expenses, but not for team building expenses.
Each custom field is typed, as indicated by the customField.type.tag discriminator:
Type.Tag
Expected value (code) - actual values are always strings
Example
String
Any text string as long as it conforms to MinLength and MaxLength.
"test"
Bool
Stringified boolean.
"true" or "false"
Int
Stringified integer
"48"
Float
Stringified float.
"18.25"
Digits
String of numbers, that must potentially conform to a minLength and maxLength.
"0495846"
ListValues
String among a list (i.e. enum; refer to values dictionary property).
"foo"
Copy
title: customFieldtype: objectproperties: id: type: string description: Unique identifier of the custom field. Keep in mind one custom field can apply to multiple expense natures. name: type: string description: Name of the custom field url: type: string format: uri type: type: object properties: tag: type: string enum: [String, Bool, Int, Float, Digits, ListValues] description: |- - `String`: any text string; - `Bool`: stringified boolean value, i.e. `"true"` or `"false"`. - `Int`: stringified integer value, i.e. `"234"`. - `Float`: stringified float value, i.e. `"0.123"`. - `Digits`: string of numbers, i.e. "0123456789". - `ListValues`: string among an list of accepted values (i.e. enumeration). case: type: object properties: tag: type: string enum: [Insensitive, Uppercase, Lowercase] description: Case sensitivity. compulsory: type: boolean description: Whether a value MUST be set on expenses of this expense-nature or not. default: false minLength: type: [integer, "null"] minimum: 0 default: null description: Minimum number of characters accepted for a value. maxLength: type: [integer, "null"] minimum: 0 descritpion: Maximum number of characters accepted for a value. defaultValue: type: string description: Explicit default for values. values: type: object description: Dictionary valueCode => valueDisplayName. Lists the enum values for a `ListValues` typed custom field. additionalProperties: type: string
In order to retrieve the list of customField values for an ExpenseTempItem or an ExpenseClaimItem, simply add “customFields” to the list of fields requested through the ?fields query parameter:
Copy
GET /api/v3/expenseTempItems?fields=id,customFields HTTPS/2Host: example.ilucca.netAuthorization: lucca application={API_KEY}Accept: application/json
The customFields field you’ll retrieve is a JSON object whose keys are the IDs of the customField.