Field
Get the field information in the datasheet
field.Field
Parameters
id
• get
id(): string
Field id, unique identification of field
Returns
string
Example
console.log(myField.id); // => 'fldxxxxxx'
name
• get
name(): string
Field name, different field name is not duplicated
Returns
string
Example
console.log(myField.name); // => 'FieldName'
type
• get
type(): FieldType
Field type, the field type is an enumeration value, please refer to FieldType
Returns
FieldType
Example
console.log(myField.type); // => 'SingleLineText'
description
• get
description(): null
| string
Return the description of the current field
Returns
null
| string
Example
console.log(myField.description);
// => 'This is my field'
property
• get
property(): IOpenFieldProperty
The configuration property of the field. The structure of the field's property depend on the field's type. Return null if the field has no property. Refer to FieldType.
Returns
IOpenFieldProperty
Example
console.log(myField.property.symbol); // => '¥'
isComputed
• get
isComputed(): boolean
A field is "computed" if its value is not set by user input.(AutoNumber, Formula, MagicLookUp, LastModifiedTime, CreatedTime, LastModifiedBy, CreatedBy, etc.)
Returns
boolean
Example
console.log(mySingleLineTextField.isComputed);
// => false
console.log(myAutoNumberField.isComputed);
// => true
isPrimary
• get
isPrimary(): boolean
Returns whether the current field belongs to the main field. In the datasheet, the main field is always the field where the first field is located.
Returns
boolean
Example
console.log(myField.isPrimary); // => true
Methods
updateDescriptionAsync
▸ updateDescriptionAsync(description
): Promise
<void
>
Updates the description for this field.
The API will throw an exception message if there is no written permission.
Parameters
Name | Type | Description |
---|---|---|
description | null \ | string |
Returns
Promise
<void
>
Example
await field.updateDescriptionAsync('this is a new description')
updatePropertyAsync
▸ updatePropertyAsync(property
, options?
): Promise
<void
>
Updates the property for this field, tips: that the update property configuration must be overwritten in full.
If the configuration format is incorrect, or if there is no written permission, the API will throw an exception message.
Refer to FieldType for supported field types, the written format for property, and other specifics for certain field types.
Parameters
Name | Type | Description |
---|---|---|
property | any | New property for the field. |
options? | IEffectOption | Allow property that will have secondary effects |
Returns
Promise
<void
>
Example
function addOptionToSelectField(selectField, nameForNewOption) {
const updatedOptions = {
options: [
...selectField.options.choices,
{name: nameForNewOption},
]
};
await selectField.updatePropertyAsync(updatedOptions);
}