Update Field
Update a new Field in a specified Table.
update_field(tableId: ID, field: AppStructureField): Promise<void>;
Parameter Name | Type | Description |
---|---|---|
tableId | string | The Id of the Table to Update the record in. |
field | AppStructureField | An object specifying the fields parameters. |
AppStructureField
Object used to define the new fields to be added in bulk.
export interface AppStructureField<TParams = AppStructureFieldParams> {
slug: string;
label: string;
field_type: Fields;
params: TParams;
id?: ID;
is_new?: boolean;
}
Property Name | Type | Description |
---|---|---|
slug | string | The slug (unique Id) of the field. |
label | string | The field display name. |
field_type | string | The SmartSuite field type. |
params | field params object | The field's configuration parameters. |
id? | string | Field Id (should be null or omitted for create). |
is_new? | boolean | A true value indicates that the field is new. |
AppStructureFieldParams
export interface AppStructureFieldParams {
required?: boolean;
unique?: boolean;
hidden?: boolean;
help_text?: string;
help_doc?: any;
placeholder?: string;
default_value?: TValue;
width?: 0 | 1 | 2 | null;
}
Property Name | Type | Description |
---|---|---|
required? | boolean | true if field is required. |
unique? | boolean | true if field value must be unique. |
hidden? | boolean | true if field is hidden in the UI. |
help_text? | string | Field help text. |
placeholder? | string | Field placeholder text. |
default_value? | string | Field default text. |
width? | number | Field column width in edit record mode. |
Example Script - Update Field
<!--update_field(tableId: ID, field: AppStructureField): Promise<void>;-->
<script>
window.SmartSuite.update_field('675c15c87763cb3760194e9d', {
slug: "s2cffa2113",
label: "Text new field name",
field_type: "textfield",
params: {
primary: false,
restore_application_id: null,
linked_field_slug: null,
max_length: null,
composite: null,
delimiter: ", ",
required: false,
unique: false,
hidden: false,
help_text: "",
help_text_display_format: "tooltip",
placeholder: "Write here",
default_value: null,
width: 1,
system: false,
valid: true,
is_migrating: false
},
}).then((res) => {
console.log('result =>>>', res);
});
</script>