Skip to content

Record Type Conversion

Overview

When using automation or scripts to create or update data table records, you need to set the fields for creation and update. For different field types, the acceptable data formats vary. Below, we will introduce the data formats that can be accepted when creating and updating for each field type separately.

Notes

Creating, updating, or deleting records using scripts or automation will not trigger listeners.

Usage Scenarios

  • Creating records in scripts: The system will automatically attempt to convert fields of non-this type to this field type before creating records
  • Updating records in scripts: The system will automatically attempt to convert fields of non-this type to this field type before updating records
  • Creating records in automation: The system will automatically attempt to convert fields of non-this type to this field type before creating records
  • Updating records in automation: The system will automatically attempt to convert fields of non-this type to this field type before updating records

Field Types

Single Text

Accepted types: String, Integer, Double, Date, Boolean, Object

Description: For non-String data, the system will automatically convert it to a string for storage

Examples:

"Test"
100
1.5
new Date();
true
{"id":"001"}

Multi-line Text

Accepted types: String, Integer, Double, Date, Boolean, Object

Description: For non-String data, the system will automatically convert it to a string for storage

Examples:

"Test"
100
1.5
new Date();
true
{"id":"001"}

Rich Text

Accepted types: String, Integer, Double, Date, Boolean, Object

Description: For non-String data, the system will automatically convert it to a string for storage

Examples:

"Test"
100
1.5
new Date();
true
{"id":"001"}

Checkbox/Switch

Accepted types: Boolean, Integer, String

Description: For String type, if it is true or 1, it will be converted to true, otherwise false; if it is Integer type, greater than 0 will be converted to true, otherwise false

Examples:

"true"
"1"
false
true
0
1

Integer

Accepted types: Integer, String, Date

Description: If it is String type, the system will automatically attempt to convert it to an integer, if failed, it will be null; if it is Date type, it will be automatically converted to a timestamp

Examples:

"1"
1
new Date();

Decimal

Accepted types: Double, Integer, String, Date

Description: If it is String type, the system will automatically attempt to convert it to a decimal, if failed, it will be null; if it is Date type, it will be automatically converted to a timestamp

Examples:

"1.5"
1
2.1
new Date();

Rating

Accepted types: Integer, String

Description: If it is String type, the system will automatically attempt to convert it to an integer, if failed, it will be 0. The value range is 0-10; if the value is not within the range, the system will report a parameter error.

Examples:

"1"
1

Date

Accepted types: Integer, String, Date, Double

Description: For non-Date type data, the system will convert it according to the following rules. If it is Integer or Double type, it will be converted to a date according to the number of milliseconds
If it is String type, first check if it can be converted to Integer, if yes, convert it according to Integer type;
If conversion fails, then try to convert it according to UTC date format (yyyy-MM-dd'T'HH:mm:ss)
If conversion fails, then convert it according to the following date formats
Formats: yyyy-MM-dd HH:mm:ss, yyyyMMdd HH:mm:ss, yyyy/MM/dd HH:mm:ss, yyyy-MM-dd HH:mm, yyyyMMdd HH:mm, yyyy/MM/dd HH:mm, yyyy-MM-dd, yyyyMMdd, yyyy/MM/dd

Examples:

new Date();
2022-12-01 00:00:00
20221201 00:00:00
2022/12/01 00:00:00
2022-12-01 00:00
20221201 00:00
2022/12/01 00:00
2022-12-01
20221201
2022/12/01
//Milliseconds
1672228625732

Time

Accepted types: String

Description: For non-String type data, the system will automatically convert it to a string for storage

Examples:

00:00:00

Attachment (Single)

Accepted types: TableAttachment

Example:

text
${
  {
    "name": "1.txt",
    "size": 100,
    "id": "3c4caa9ec4ba46579eb75113ea247222.txt",
    "thumbnail": "3c4caa9ec4ba46579eb75113ea247222.txt",
    "md5": "d41d8cd98f00b204e9800998ecf8427e",
    "path": "k9hkutyiiutib/skt92kcpz6uer/3c4caa9ec4ba46579eb75113ea247222.txt"
  }
}

Attachment (Multiple)

Accepted types: Array<TableAttachment>

Example:

text
${
  [
    {
      "name": "1.txt",
      "size": 100,
      "id": "3c4caa9ec4ba46579eb75113ea247222.txt",
      "thumbnail": "3c4caa9ec4ba46579eb75113ea247222.txt",
      "md5": "d41d8cd98f00b204e9800998ecf8427e",
      "path": "k9hkutyiiutib/skt92kcpz6uer/3c4caa9ec4ba46579eb75113ea247222.txt"
    }
  ]
}

List Selection (Single)

Accepted types: String

Description: Pass the option identifier

Example:

For the gender field with the following options:

NameIdentifier
Malemale
Femalefemale
male

List Selection (Multiple)

Accepted types: Array<String>

Description: Pass an array of option identifiers

Example:

text
${["male", "female"]}

Cascading Selection (Single)

Accepted types: Array<String>

Example:

text
${["Guangdong Province", "Shenzhen City"]}

Cascading Selection (Multiple)

Accepted types: Array<Array<String>>

Example:

text
${
    [
        ["Guangdong Province", "Shenzhen City", "Nanshan District"],
        ["Guangdong Province", "Shenzhen City", "Futian District"]
    ]
}

Tree Selection (Single)

Accepted types: String

Description: Pass the option identifier

Example:

01

Tree Selection (Multiple)

Accepted types: Array<String>

Description: Pass an array of option identifiers

Example:

text
${["s1", "s2"]}

User Selection (Single)

Accepted types: String, TableAccountSimple

Description: If it is String type, the system will treat it as an account ID

Examples:

User Selection (Multiple)

Accepted types: Array<String>, Array<TableAccountSimple>

Description: If the data type in the array is String, the system will treat it as an account ID

Examples:

Department Selection (Single)

Accepted types: String, TableDepartmentSimple

Description: If it is String type, it represents the department identifier

Examples:

Department Selection (Multiple)

Accepted types: Array<String>, Array<TableDepartmentSimple>

Examples:

Color

Accepted types: String

Description: Color code

Examples:

#8E1212
rgb(171, 42, 42)

Handwritten Signature (Single)

Accepted types: TableSignature

Description: See handwritten signature field description for TableSignature

Example:

text
${
    {
      "id": "6810a6f92c0846e2910672a2a6f69e78.jpg",
      "accountId": "x38s0fa436v69",
      "accountName": "Li Siming",
      "uploadTime": 1672129509967
    }
}

Handwritten Signature (Multiple)

Accepted types: Array<TableSignature>

Description: See handwritten signature field description for TableSignature

Example:

text
${
  [
    {
      "id": "6810a6f92c0846e2910672a2a6f69e78.jpg",
      "accountId": "x38s0fa436v69",
      "accountName": "Li Siming",
      "uploadTime": 1672129509967
    }
  ]
}

Geographical Coordinates

Accepted types: TableCoordinate

Description: See geographical coordinate field description for TableCoordinate

Example:

text
${
    {
        "lng":114.057201,
        "lat":22.538136,
        "address":"Futian Station, Futian District, Shenzhen City, Guangdong Province"
    }
}

Accepted types: String

Description: The field where the associated record is stored as specified in the related record configuration (default is ID)

Example:

target-record-id

Sub-object

Accepted types: String

Description: The complete path of the parent node

Example: The ID of record B (parent of record A) is b, the ID of record C (parent of record B) is c, and record C has no parent. Then the data stored in the sub-object field of record A is c.b, the data stored in the sub-object field of record B is c, and the data stored in the sub-object field of record C is empty.

Accepted types: Integer, Double

Description: Stored rollup value

Example:

12.56

Lookup Rollup

Accepted types: Integer, Double

Description: Stored rollup value

Example:

12.56

Serial Number

Accepted types: String

Description: The serial number is automatically calculated and stored as a string (can be modified by automation or script)

Example:

1

Sub-object Number

Accepted types: String

Description: The sub-object number is automatically calculated and stored as a string (can be modified by automation or script)

Example:

1.1.1

Creation Time

Same as the Date field

Last Modification Time

Same as the Date field

Creator

Accepted types: String

Description: The creator stores the account ID

Last Modifier

Accepted types: String

Description: The creator stores the account ID

Value Passing for List Type Fields

In the Update Record step of automation, for the three list type fields: Lookup List, Related List, and Sub-object, there may be three actions when saving: Add, Edit, and Delete When passing Array<Object> type data to these three types of fields, the judgment will be made based on the id field and $deleted field in the Object, with specific judgment rules as follows:

  • If id is not equal to null, the system will perform an update action on the child table data
  • If the $deleted attribute is equal to true and id is not equal to null, the system will perform a delete action on the child table data
  • If id is equal to null, the system will perform an insert action on the child table data

Example of Using List Type Fields

text
${
    [
        { name: 'Zhang San', age: 100 },//Insert into child table
        { id: 1, name: 'Zhang San', age: 100 },//Update child table
        { id: 1, $deleted: true, name: 'Zhang San', age: 100 }//Delete from child table
    ]
}

In scripts, the three list type fields: Lookup List, Related List, and Sub-object need to be handled separately

Lookup List

Sub-object

Update Sub-object Field