diff --git a/packages/server/src/utilities/rowProcessor/index.ts b/packages/server/src/utilities/rowProcessor/index.ts index 7332f8b244..e63750bff9 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -134,8 +134,10 @@ async function processDefaultValues(table: Table, row: Row) { for (const [key, schema] of Object.entries(table.schema)) { if ("default" in schema && schema.default != null && row[key] == null) { - const processed = await processString(schema.default, ctx) - + const processed = + typeof schema.default === "string" + ? await processString(schema.default, ctx) + : schema.default try { row[key] = coerce(processed, schema.type) } catch (err: any) { diff --git a/packages/shared-core/src/table.ts b/packages/shared-core/src/table.ts index 8a8069ce4d..57f6854604 100644 --- a/packages/shared-core/src/table.ts +++ b/packages/shared-core/src/table.ts @@ -53,8 +53,9 @@ const allowDefaultColumnByType: Record = { [FieldType.DATETIME]: true, [FieldType.LONGFORM]: true, [FieldType.STRING]: true, + [FieldType.OPTIONS]: true, + [FieldType.ARRAY]: true, - [FieldType.OPTIONS]: false, [FieldType.AUTO]: false, [FieldType.INTERNAL]: false, [FieldType.BARCODEQR]: false, @@ -64,7 +65,6 @@ const allowDefaultColumnByType: Record = { [FieldType.ATTACHMENTS]: false, [FieldType.ATTACHMENT_SINGLE]: false, [FieldType.SIGNATURE_SINGLE]: false, - [FieldType.ARRAY]: false, [FieldType.LINK]: false, [FieldType.BB_REFERENCE]: false, [FieldType.BB_REFERENCE_SINGLE]: false,