Fixed custom variable tokens

X-Lovable-Edit-ID: edt-124776c0-642a-4d39-9021-29d9f1c17bd1
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 20:06:38 +00:00
co-authored by renee-png
+6
View File
@@ -95,9 +95,12 @@ export function buildVarMap(ctx: LoadedContext): VarMap {
}
ctx.clientFields.forEach((f) => {
m[`client.field.${f.key}`] = f.value;
m[`client.custom.${f.key}`] = f.value;
});
ctx.caseFields.forEach((f) => {
m[`case.field.${f.key}`] = f.value;
m[`case.custom.${f.key}`] = f.value;
m[`custom.${f.key}`] = f.value;
});
return m;
}
@@ -128,7 +131,10 @@ export function buildChips(ctx: LoadedContext): VarChip[] {
let label = labelMap[key];
if (!label) {
if (key.startsWith("client.field.")) label = `Client · ${key.replace("client.field.", "")}`;
else if (key.startsWith("client.custom.")) label = `Client · ${key.replace("client.custom.", "")}`;
else if (key.startsWith("case.field.")) label = `Case · ${key.replace("case.field.", "")}`;
else if (key.startsWith("case.custom.")) label = `Case · ${key.replace("case.custom.", "")}`;
else if (key.startsWith("custom.")) label = `Case · ${key.replace("custom.", "")}`;
else label = key;
}
out.push({ token: `{{${key}}}`, label, value: m[key] });