0

I am showing a description based on the value of points

%%[ var @firstname,@memberid , @points , @desc

Set @firstname = [FirstName]
Set @memberid = [MemberId]
Set @points = [Points]

%%[ If @points > 150 Then ]%%
Set @desc = 'you are a platinum customer'
%%[elseif @points > 100 ]%%
Set @desc = 'You are a gold customer'
%%[elseif @points > 50 ]%%
set @desc = 'You are a silver customer'
%%[elseif  ]%%
set @desc = 'You are an insider customer'
%%[ENDIF ]%%

]%%

Dear %%=v(@firstname)=%% , Your  Member ID : %%=v(@memberid)=%%  . Based upon your points %%=v(@desc)=%%

I am getting an error: An IF/ELSEIF statement is invalid. No terminating THEN for the statement is found. Please Help !

1 Answer 1

1

Once you open a AMPscript block with %%[ you shouldn't have another open block till you close it, so your AMPscript should be something more like

%%[ var @firstname,@memberid , @points , @desc

Set @firstname = [FirstName]
Set @memberid = [MemberId]
Set @points = [Points]

If @points > 150 Then 
Set @desc = 'you are a platinum customer'
elseif @points > 100 THEN
Set @desc = 'You are a gold customer'
elseif @points > 50 THEN
set @desc = 'You are a silver customer'
else  
set @desc = 'You are an insider customer'
ENDIF ]%%
4
  • Hey Thanks for responding! I tried that code and I am getting this error: An IF/ELSEIF statement is invalid. No terminating THEN for the statement is found.
    – Rohan
    Feb 11, 2022 at 0:58
  • 1
    Do what EazyE wrote, but add a THEN at the end of each line starting with ELSEIF. Also, consider making the last ELSEIF an ELSE - in this case with no THEN. As can be seen in the docs here - developer.salesforce.com/docs/marketing/marketing-cloud/guide/… Feb 11, 2022 at 8:25
  • Updated code with @JonasLamberty suggestions :)
    – EazyE
    Feb 11, 2022 at 13:57
  • Guys it worked out with the changes !! Thanks :)
    – Rohan
    Feb 11, 2022 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .