Skip to main content

This is driving me nuts. I’m sure it’s gonna be something really goofy but for some reason this Ampscript does not like me.

It all works except for the replacement value (College Coaches) when “College Coach” is null.

Any ideas?

 

%%[ 

set @FirstName = ProperCase([First Name])

]%%

%%[    

/* Set default value if Coach Name is null */

SET @CoachName = AttributeValue("Coach Name")

 

IF EMPTY(@CoachName) OR @CoachName == "Integration" OR @CoachName == "Integration2" THEN

    SET @CoachName = "College Coaches"

ENDIF

 

/* Set default value if Coach Email is null */

SET @CoachEmail = AttributeValue("Coach Email")

 

IF EMPTY(@CoachEmail) OR @CoachEmail == "

email@domain.edu" OR @CoachEmail == "email2@domain.edu

" THEN

    SET @CoachEmail = "

default@domain.edu

"

ENDIF

]%%

 

#AMPscript #Marketing Cloud
1 commentaire
  1. 12 juil. 2023, 07:34

    Finally figured it out so hopefully this will help someone else ... for some reason there's a space in the "Coach Name" field so it wasn't empty or null.

     

    Added  OR @CoachName == " " to the if statement and everything started working as expected.

     

    Updated code:

     

    IF EMPTY(@CoachName) OR @CoachName == " " OR @CoachName == "Integration" OR @CoachName == "Integration2" THEN

    SET @CoachName = "College Coaches"

    ENDIF

0/9000