2

I am trying to display relevant content to users of a certain type (pro or commercial), but I do have some users that are marked as both. in that case i am using another field (customer type) to determine the content they should receive. I get an error in testing "Error 1: Script IF Statement Invalid An error occurred when attempting to resolve a script expression. See inner exception for detail. Script Expression: ("Commercial"

%%[IF @PRO == TRUE AND @COMM == TRUE AND @CustomerType == ("Commercial" OR 
"Architect" OR "Builder") THEN]%%
 <--commercial content-->

[ELSEIF @PRO == TRUE AND @COMM == TRUE AND @CustomerType == ("Professional" 
OR "Consumer" OR "Contractor") THEN]%%
<--Pro content-->

%%[ELSE]%%
<--default content-->

%%[ENDIF]%%
  • If my answer helped solve your problem, please mark it as accepted by clicking on the checkmark-symbol on the left of it. Thank you! – Markus Slabina Feb 1 at 12:59
6

You cannot check for multiple strings in a single variable like you did. You need to split the expression. Additionally you are missing two percent-signs for the elseif-part.

So the following part:

@CustomerType == ("Commercial" OR "Architect" OR "Builder")

is changed to this:

(@CustomerType == "Commercial" OR @CustomerType == "Architect" OR @CustomerType == "Builder")

This also needs to be done for the expression in the elseif. So this would be the complete code snippet:

%%[IF @PRO == TRUE AND @COMM == TRUE AND (@CustomerType == "Commercial" OR @CustomerType == "Architect" OR @CustomerType == "Builder") THEN]%%
    <--commercial content-->
%%[ELSEIF @PRO == TRUE AND @COMM == TRUE AND (@CustomerType == "Professional" OR @CustomerType == "Consumer" OR @CustomerType == "Contractor") THEN]%%
    <--Pro content-->
%%[ELSE]%%
    <--default content-->
%%[ENDIF]%%

Helpful resources:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.