Mark Handy
Mark Handy

Reputation: 1256

Kentico 9 form macros and different notification recipient based on dropdown value

I have a form field as a drop down (ReasonForMessage) with the data like this:

[email protected];Reason One
[email protected];Reason Two

So user can select a reason, and then the notification would be send to address attached to that reason. If the Email Notification, for the recipient emails, how do i grab just them email portion with a macro.

Is this correct? {% ReasonForMessage %}

And how do i get the second part of the data, the actual Reason?

I'm basing this on this article (https://devnet.kentico.com/articles/how-to-send-form-notifications-to-different-emails-based-on-field-values) just not sure it's still valid with Kentico 9.

Upvotes: 0

Views: 277

Answers (1)

Saurav Kumar
Saurav Kumar

Reputation: 56

Try this.
You can try using a delimiter to store both the email and display text, like the colon below...

[email protected]:General;General
[email protected]:Sales;Sales
[email protected]:Support;Support

Then, to get the individual stored values use Split() to get the email and display text respectively...

{% category.Split(":")[0] %}
{% category.Split(":")[1] %}

Upvotes: 3

Related Questions