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

* fix: dynamic text variable not populating

* Update customTemplate.ts
This commit is contained in:
Anik Dhabal Babu authored and GitHub committed 2025-04-14 10:54:43 +05:30
1 parent bdf3935704
commit b15060e306
1 file changed
+7
@@ -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;
}