Forms Notification email - accessing name part of value name pair

Kevin Loughran asked on January 23, 2018 12:41

Hi Folks,

Having an issue on a Contact Us Form. On the form we use a Value-Name pair to support sending the email to different sections on the organisation depending on the type of Enquiry.

The issue is that in the notification email we want to send back the data for the Name rather than the email address (Value). We setup a custom layout but how do we access the name part of the Value – Name pair. Obviously $$value@Contact_EnquiryType$$ brings back the value (i.e. the email) but $$name@Contact_EnquiryType$$ doesn’t bring back the name.

Is there any easy way around this using a Macro etc..?

Thanks in advance for any help.

Correct Answer

Trevor Fayas answered on January 23, 2018 14:24

It won't pass that value back, so if you want to get it via macro what I would do is create a custom table that has the to fields, value and name, and then in your form use a SQL query to pull the value name from that table.

Then via macro, you can select from the custom table where the value equals your value in the form, and then show the name column.

My syntax may be a bit of, just doing from memory

{% siteobjects.customtables["my.table"].items.where("value='"+theformfieldnamewithvalue+"'").first item.getvalue("name") |(identity)GlobalAdministrator%}

0 votesVote for this answer Unmark Correct answer

Recent Answers

Deb Apprille answered on February 6, 2018 18:05 (last edited on February 6, 2018 18:34)

I am having this exact same problem in Kentico 8.2.

Kentico is grabbing the value (as outlined in maroon below) of the pair. I want the name displayed (as outlined in green below).

Image Text

Edit: I tried to follow what Trevor suggested but when I received the email, the field was blank. Is there anyway I can test it without going through the process of filling out a whole form and waiting for the email? I am new to macros and perhaps I did it incorrectly. Here is my syntax:

siteobjects.customtables["Form_ATECorp_Quickquote"].items.where("value='"+howDidYouHearAboutATEC+"'").first item.getvalue("name")

0 votesVote for this answer Mark as a Correct answer

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