Conditional keyword replacement in email body

(Mitch Kerry) #1


We want to be able to display different responses based on the value of one of the responses in the body of an email.

Something similar to this:
%response_XXXX_q1^eq:test:%response_XXXX_q2%:%response_XXXX_q3%% (this breaks)

%response_XXXX_q1^eq:test:{%response_XXXX_q2%}:{%response_XXXX_q3%}% (this breaks)

Is this possible in our version?

Appreciate the help

(Hugh McMaster) #2

Custom form responses are typically values in an array or a JSON object, depending on what type of form field you’re using.

Have you checked the output of %response_XXXX_q1% or checked %globals_post%?

(Mitch Kerry) #3


Yes I can get the values, but when I put the keyword replacements in the conditional it breaks.

I have tried:

The response is: %response_123783_q1%
Is the response test? %response_123783_q1^eq:test:yes %response_123783_q1%:no %response_123783_q1%%
Is the response test? %response_123783_q1^eq:test:yes %globals_response_123783_q1%:no %globals_response_123783_q1%%
Is the response test? %response_123783_q1^eq:test:yes {%globals_response_123783_q1%}:no {%globals_response_123783_q1%}%
Is the response test? %response_123783_q1^eq:test:yes%globals_post_q123783:q1%:no%
Is the response test? %response_123783_q1^eq:test:yes{%globals_post_q123783:q1%}:no%


This is the email:
The response is: test

Is the response test? %response_123783_q1^eq:test:yes test:no test%

Is the response test? yes globals_response_123783_q1%:no %

Is the response test? yes {globals_response_123783_q1%}:no {}%

Is the response test? yesglobals_post_q123783:q1%:no%

Is the response test? yes{globals_post_q123783:q1%}:no%



What I would expect is:
Is the response test? yes test
Is the response test? no


(Hugh McMaster) #4

Okay. What happens if you try these keywords:


(Mitch Kerry) #5

So we’ve worked it out.

We applied a paint layout to the submission email body:

And then in the paint layout we can use the conditional:
Question is equal to test. Here is the field
It is not test

Hope that helps.


(Hugh McMaster) #6

This won’t work as you intend. It’s not a valid keyword sequence.

The ‘else’ line should be %else_question%.

Also, does your paint layout apply correctly for emails sent to public users?

(Mitch Kerry) #7

Thanks Hugh

Actually no…it doesn’t work for public users we’ve since found out.
Yet to get to the bottom of that.

(Hugh McMaster) #8

Okay, if you find out, I’d be interested in the solution. Otherwise, I’d suggest following the solution here: Paint layout in custom form emails

(Emily) #9

Hi Mitch,

I had a similar discovery a few months ago, with the PL not showing for Public Users.

I instead switched to using globals_contents_raw:123
Where asset #123 is a Standard Page, and then in that standard page I used Conditional Statements to determine what to print.
The Conditional Statements were using globals_post^index keywords - as per the link Hugh gave.

Now I am just trying to work on customising the Subject Line based on what they input… This has been a thorn. Many Keyword Modifiers didn’t seem to work in the Subject Line. Our form is a bit complex because it has 5 fields it needs to read to check if the email is a complaint (from any of the 5 user types). I’m sure a JS code could help me here, in sending a new field POST data that says it IS a complaint or not… :thinking:

Hope this helps,