Custom fields

Custom fields

Custom fields are user-defined additional fields which may be added to various object types.

Custom fields may come and go, ie. a custom field can deleted at any time, and new custom fields may be created at any time. Custom fields are recognised by their name, which starts with custom followed by a number (the custom field ID), eg. custom34.

Use GetCustomFields to retrieve details about the custom fields for each type of object. The API call will return a list of customfield objects for each object type.

Visibility

If f.ex. a custom field belongs to an equipment, then it may be visible only for equipments of a certain type. F.ex. you may have equipments of type “Car” and other equipment of type “Machinery” so if you have a custom field name “Licenseplate” then it makes sense to make it visible only for the equipment type “Car”. The visibility field in the customfield object specifies the type IDs for which the field should be visible. Notice that the type field differs depending on the type of object, f.ex. for todos the type field is actually the field workareaid, whereas for equipment it is the field groupid.

Example: A custom field X for todos/tasks has the visibility field set to include the IDs 3, 4, 5 and 6. A task has the workareaid field set to 5. So the custom field X should be displayed for this task, as 5 is included in the list of IDs.

Object type

Field which determines visibility

todo

workareaid

tools

groupid

customers

typeid

users

usertypeid

person

typeid

 

Types

 

type

description

data type

formatted type

example

type

description

data type

formatted type

example

1

text

string

string

Some text

2

checkbox

boolean

boolean

0 or 1

3

dropdown

set

string

['Blue','Green','Red'], the value of the field is a value from the set, eg. 'Blue'

4

number

number

number

123

6

date

date

date

2019-02-21

7

multicheck

set

string

[1,2,3,4], the value of the field is a collection of values from the collection, eg. [2,4]

8

longtext

string

string

line breaks are specified as \n

9

user

number

string

3 (the ID of a user)

10

icon

number

string

3 (the ID of an icon, see GetIcons)

11

URL

string

string

http://www.microbizz.dk/

12

customer

number

string

123 (the ID of a customer)

13

colour

string

string

#ff0000

14

indexedmenu

set

string

should not be supported in current versions of the app

15

time

time

time

12:30:43

16

address

set

string

contains the fields name,adress,adress2,zip,city,country,lat,lon

17

combobox

string

string

a combobox is like a text box but also includes predefined values which are likely to be used

18

team

number

string

5 (the ID of a team, see GetTeams)

19

icon url

set

string

should not be supported in current versions of the app

20

person

number

string

51 (the ID of a user)

The subtype field in the customfield object applies to custom fields of type 1=text. The value can be either: 0=plain text, 1=phone number, 2=email, 3=readonly text. It should not be possible to edit fields with subtype 3=readonly text.

If the showinapp in the customfield object is 0 then the field is never visible in the app.

The custom fields for an object are transferred together with the other fields for the object; the custom fields are named customXX where XX is the ID of the custom field, so if the todo object has an custom field with the ID 34, then the todo object will include a field named custom34 which holds the formatted value. The raw, unformatted values are specified in a field named _rawcustom34.

F.ex. an address custom field with the ID 34 will be included as two fields named custom34 and _rawcustom44. custom34 may hold the string 23 Wall Street, NY whereas _rawcustom34 holds a set with some of the fields name,adress,adress2,city,zip,country,lat,lon, f.ex. (in JSON format) : { “adress”:“23 Wall Street”,“adress2”:“Third floor”,“city”:“NY”,“country”:“US” }.