Skip to main content

Update Field

Update a new Field in a specified Table.

update_field(tableId: ID, field: AppStructureField): Promise<void>;
Parameter NameTypeDescription
tableIdstringThe Id of the Table to Update the record in.
fieldAppStructureFieldAn 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 NameTypeDescription
slugstringThe slug (unique Id) of the field.
labelstringThe field display name.
field_typestringThe SmartSuite field type.
paramsfield params objectThe field's configuration parameters.
id?stringField Id (should be null or omitted for create).
is_new?booleanA 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 NameTypeDescription
required?booleantrue if field is required.
unique?booleantrue if field value must be unique.
hidden?booleantrue if field is hidden in the UI.
help_text?stringField help text.
placeholder?stringField placeholder text.
default_value?stringField default text.
width?numberField 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>