0

Does Inline If not work for personalisation strings?

I have the following code:

http://www.website.com?utm_source=sfmc&utm_medium=%%=IIF(NOT EMPTY(%%Variable1%%), %%Variable1%%, "")=%%

Does not seem to work, The output comes out as:

http://www.website.com?utm_source=sfmc&utm_medium=%%=IIF(NOT EMPTY(email), email, "")=%%

But my expected output would be:

http://www.website.com?utm_source=sfmc&utm_medium=email

Thanks in advance!

0

1 Answer 1

4

I dont know if you want to display the link or if it should be inside a but usually i would go for something with concat or redirect (depending on the use case)

%%=Concat('http://www.website.com?utm_source=sfmc&utm_medium=',IIF(NOT EMPTY(Variable1), Variable1, ""))=%%

or

%%=RedirectTo(Concat('http://www.website.com?utm_source=sfmc&utm_medium=',IIF(NOT EMPTY(Variable1), Variable1, "")))=%%

This only works with personalization strings like emailaddr if you need to get variables or some transformation you need to set the variables first, and it then would become something like:

%%=RedirectTo(Concat('http://www.website.com?utm_source=sfmc&utm_medium=',IIF(NOT EMPTY(@variable1), @variable1, "")))=%%

Ressource:

1
  • That's what I wanted to clarify, thanks so much Johannes!
    – s3002068
    Commented Jun 15, 2020 at 7:22

You must log in to answer this question.

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