From b15060e3066779e0ed6a9ac57b92889ffbe906e9 Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Mon, 14 Apr 2025 10:54:43 +0530 Subject: [PATCH] fix: dynamic text variable not populating on workflows (#20657) * fix: dynamic text variable not populating * Update customTemplate.ts --- .../ee/workflows/lib/reminders/templates/customTemplate.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts index 27c5c421a4..1966c2eb7c 100644 --- a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts +++ b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts @@ -30,6 +30,11 @@ export type VariablesType = { eventEndTimeInAttendeeTimezone?: Dayjs; }; +// Replaces placeholders like {EVENT_NAME_VARIABLE} with {EVENT_NAME} +function replaceVariablePlaceholders(text: string) { + return text.replace(/\{([A-Z0-9_]+)_VARIABLE}/g, (_, base) => `{${base}}`); +} + const customTemplate = ( text: string, variables: VariablesType, @@ -46,6 +51,8 @@ const customTemplate = ( let locationString = variables.location || ""; + text = replaceVariablePlaceholders(text); + if (text.includes("{LOCATION}")) { locationString = guessEventLocationType(locationString)?.label || locationString; }