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
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
    Jun 15 '20 at 7:22

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.