Kentico 12 MVC BizForm Email Notification to Different Recipients

Jon Bowen asked on February 28, 2020 16:08

I've created a Biz Form in Kentico 12 SP that has a Department drop down list. The customer wants an email to be sent to a different person inside the company based on what department the user selects. I easily can setup an email notification for the BizForm on the "Email notification" tab of the BizForm to go to one person. How can I override and use a different email address based on the form field 'department'

Thank you in advance!

Correct Answer

Brenden Kehren answered on February 28, 2020 16:13

In your department field have the values setup like so:

email1@email.com;Marketing
email2@email.com;Accounting
email3@email.com;Information Technology

Then in your email notification tab, you set the To with a value of {%Department%} and it will choose the email address saved when someone selects the list item.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Jon Bowen answered on February 28, 2020 16:27

That's an elegant and awesome solution, thank you! I didn't realize the To field allowed macros. The only thing I may get asked is if the Department name can still be saved along with the email address. I'm guessing not. It's a minor issue and no problem either way.

Thanks again!

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on February 28, 2020 16:31

You could modify the values of the dropdown so the department name is part of it but then you'd have to parse that out when sending emails and remove everything but the email address otherwise it will be an invalid email and not send.

0 votesVote for this answer Mark as a Correct answer

Jon Bowen answered on February 28, 2020 17:16

I took your suggestion and it worked well. You definitely saved me hours of research and frustration. Thanks again!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.