Skip to content

Scheduling infrastructure for absolutely everyone.

fix: dynamic text variable not populating on workflows (#20657)

Anik Dhabal Babub15060e30667
diff --git a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts
index 27c5c421a44..1966c2eb7ce 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;
}