Bulk Add Fields
Create multiple new Fields in a specified Table.
bulk_add_fields(
tableId: ID,
memberId: ID,
fields: AppStructureField[],
reportIds?: ID[]
): Promise<void>;
Parameter Name | Type | Description |
---|---|---|
tableId | string | The Id of the Table to create the fields in. |
memberId | string | Member Id of the creating Member. |
fields | AppStructureField[] | Member Id of the creating Member. |
reportIds | string[] | Array of View (report) Ids to add the new fields to. |
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 - Bulk Add Fields
<!-- bulk_add_fields(
appId: ID,
memberId: ID,
fields: AppStructureField[],
reportIds?: ID[]
): Promise<void>;-->
<script>
window.SmartSuite.bulk_add_fields('675adf9bb73844be508989b8', '6613e6ec7241809b1756db91', [
{
'label': 'Text 3',
'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,
},
'is_new': true,
}
]).then((res) => {
console.log('result =>>>', res);
});
</script>