diff --git a/src/lib/forms-shared.ts b/src/lib/forms-shared.ts index 978c481..2749753 100644 --- a/src/lib/forms-shared.ts +++ b/src/lib/forms-shared.ts @@ -355,3 +355,16 @@ export async function fetchCaseCustomValues(caseId: string): Promise> { + const { data } = await supabase + .from("client_field_values") + .select("value, field:custom_client_fields(key)") + .eq("client_id", clientId); + const map: Record = {}; + (data ?? []).forEach((row: any) => { + const k = row.field?.key; + if (k) map[k] = row.value ?? ""; + }); + return map; +}