Conditional keyword replacement in email body


(Mitch Kerry) #1

5.0.4.3

Hi

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
Mitch


(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

Hi

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%

%globals_post%
%globals_post_q123783:q1%

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%

{“SQ_FORM_123768_PAGE”:“1”,“form_email_123768_referral_url”:"",“q123783:q1”:“test”,“form_email_123768_submit”:“Submit”}

test

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

thanks


(Hugh McMaster) #4

Okay. What happens if you try these keywords:

%response_123768_q1^eq:test%
%response_123768_q1^eq:test:{response_123768_q2}:{response_123768_q3}%


(Mitch Kerry) #5

So we’ve worked it out.

We applied a paint layout to the submission email body:
%form_submission_id^as_asset:asset_contents_paint_layout_id_123456%

And then in the paint layout we can use the conditional:
%begin_question_answer_123321_q1^eq:test%
Question is equal to test. Here is the field
%question_answer_123321_q1%
%else_question_answer_123321_q1^neq:test%
It is not test
%end_question_answer_123321_q1%

Hope that helps.

Mitch


(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