1

Error I'm getting: "An IF statement is not closed with the required ENDIF statement"

Please help!

%%[IF @EventType=='Lunch n' Learn' THEN]%%
SET @Image = Image('b3272b99-f070-4e84-a65e-2a6cae73c794')

%%[ELSEIF @EventType=='Other' THEN]%%
SET @Image = Image('ba986d68-805d-4822-984e-4e5265a555ed')

%%[ELSEIF @EventType=='HomeBuyer Seminar' THEN]%%
SET @Image('78497a9e-8272-4a92-99cd-080267c389d8')

%%[ELSEIF @EventType =='Open House' THEN}%%
SET @Image = Image('ba986d68-805d-4822-984e-4e5265a555ed')

%%[ELSEIF @EventType=='Customer Appreciation Event' THEN]%%
SET @Image = Image('5a3f62da-4b3f-4f06-b581-3cffbdbe87a6')

%%[ELSEIF @EventType == 'Happy Hour' THEN}%%
SET @Image = Image('8ad87c03-d300-48a6-b62d-fddab1f57904')

%%[ELSEIF @EventType == 'VIP Agent Appreciation' THEN]%% 
SET @Image = Image('8ad87c03-d300-48a6-b62d-fddab1f57904')

%%[ENDIF]%%
2

@Data_Kid answer is right, but there are some other syntax issues with your AMPscript block.

You had an issue with 'Lunch n' Learn' as stated in referenced answer above. (use double quotes instead of single)

You had a }%% instead of an ]%% after your open house if statement.

You do not need to keep opening and closing your blocks for the if statement when you are running AMPscript afterwards. This is only necessary if you are putting conditional HTML or CSS.

There are also no script identifiers around the 'SET' values you have under each if statement, meaning it will be rendered as text/HTML.

Please see below:

%%[
IF @EventType=="Lunch n' Learn" THEN

  SET @Image = Image('b3272b99-f070-4e84-a65e-2a6cae73c794')

ELSEIF @EventType=='Other' THEN

  SET @Image = Image('ba986d68-805d-4822-984e-4e5265a555ed')

ELSEIF @EventType=='HomeBuyer Seminar' THEN

  SET @Image('78497a9e-8272-4a92-99cd-080267c389d8')

ELSEIF @EventType =='Open House' THEN

  SET @Image = Image('ba986d68-805d-4822-984e-4e5265a555ed')

ELSEIF @EventType=='Customer Appreciation Event' THEN

  SET @Image = Image('5a3f62da-4b3f-4f06-b581-3cffbdbe87a6')

ELSEIF @EventType == 'Happy Hour' THEN

  SET @Image = Image('8ad87c03-d300-48a6-b62d-fddab1f57904')

ELSEIF @EventType == 'VIP Agent Appreciation' THEN

  SET @Image = Image('8ad87c03-d300-48a6-b62d-fddab1f57904')

ENDIF
]%%
2

%%[IF @EventType=='Lunch n' Learn' THEN]%%

should be

%%[IF @EventType=="Lunch n' Learn" THEN]%%

1

'Lunch n' Learn' . The middle apostrophe is breaking the script. The answer to this question should help Escaping characters within AMPscript /Javascript hybrid

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.