diff --git a/packages/app-store/routing-forms/trpc/utils.ts b/packages/app-store/routing-forms/trpc/utils.ts index eb77d6e1f0..21503cf646 100644 --- a/packages/app-store/routing-forms/trpc/utils.ts +++ b/packages/app-store/routing-forms/trpc/utils.ts @@ -191,16 +191,18 @@ export async function onFormSubmission( return acc; }, [] as OrderedResponses); - if (form.settings?.emailOwnerOnSubmission) { + if (form.teamId) { + if (form.userWithEmails?.length) { + moduleLogger.debug( + `Preparing to send Form Response email for Form:${form.id} to users: ${form.userWithEmails.join(",")}` + ); + await sendResponseEmail(form, orderedResponses, form.userWithEmails); + } + } else if (form.settings?.emailOwnerOnSubmission) { moduleLogger.debug( `Preparing to send Form Response email for Form:${form.id} to form owner: ${form.user.email}` ); await sendResponseEmail(form, orderedResponses, [form.user.email]); - } else if (form.userWithEmails?.length) { - moduleLogger.debug( - `Preparing to send Form Response email for Form:${form.id} to users: ${form.userWithEmails.join(",")}` - ); - await sendResponseEmail(form, orderedResponses, form.userWithEmails); } } diff --git a/packages/prisma/zod-utils.ts b/packages/prisma/zod-utils.ts index 85654da270..864b8caeee 100644 --- a/packages/prisma/zod-utils.ts +++ b/packages/prisma/zod-utils.ts @@ -522,7 +522,10 @@ export const successRedirectUrl = z export const RoutingFormSettings = z .object({ + // Applicable only for User Forms emailOwnerOnSubmission: z.boolean(), + + // Applicable only for Team Forms sendUpdatesTo: z.array(z.number()).optional(), sendToAll: z.boolean().optional(), })