0

I am trying to create a sender profile that allows me to change the name based on a subscriber's attribute. This is about 95% complete, 3/4 test cases I have work. There is one still lingering though, one of the test cases will get a the %%RP External Wholesaler%% when they have NAM Key Contact RP as Contact Type and have RP NAM as Marshall Urbanz. So they should of received "Marshal Urbanz" as the form name but instead they got the External Wholesaler name.

I think it may have to do with the fact that i'm trying == "", i've tried using the empty() function but sender profiles won't let me use functions such as this or and ELSEIF... Any ideas what i'm missing?

%%[ IF Contact Type == "NAM Key Contact RP" THEN ]%%

%%[ IF RP NAM == "Marshall Urbanz" THEN ]%% 
Marshall Urbanz 
%%[ ELSE ENDIF 

IF RP NAM == "Mary McCormack" THEN ]%% 
Mary McCormack  
%%[ ELSE ENDIF 

ELSE ENDIF]%% 

%%[IF RP External Wholesaler == "" AND Contact Type == "" THEN]%%
Securian Retirement Distributors
%%[ELSE]%%
%%RP External Wholesaler%% 
%%[ ENDIF ]%%
0

I'd set AMPScript variables for all of the profile attributes using the AttributeValue() function. It handles the null/empty a lot better:

%%[
var @ContactType, @RPNAM, @RPExternalWholesaler, @name, @title
set @ContactType = AttributeValue("Contact Type")
set @RPNAM = AttributeValue("RP NAM")
set @RPExternalWholesaler = AttributeValue("RP External Wholesaler")

set @name = ""

if @contactType == "NAM Key Contact RP" then

  if @RPNAM == "Marshall Urbanz" or @RPNAM == "Mary McCormack" then
    set @name = @RPNAM
  endif

endif

if empty(@RPExternalWholesaler) and empty(@ContactType) then
  set @title = "Securian Retirement Distributors"
else
  set @title = @RPExternalWholesaler
endif 

]%%
%%=v(@name)=%%<br>
%%=v(@title)=%%
  • Thanks Adam, this worked great for me. I did find one thing I missed while going through this, I needed to put "if empty(name) then" around the second IF statement. I was running into the issue where i'd always get the last else statement but this line fixes that. I also changed title to name so simplify the code. – Shane Aug 7 '15 at 17:05
1

Assuming the logic is correct, the syntax you are using might work better with a closed bracket on line 5.

    %%[IF Contact Type == "NAM Key Contact RP" THEN]%%

        %%[IF RP NAM == "Marshall Urbanz" THEN]%% 
        Marshall Urbanz 
        %%[ELSE ENDIF]%%

        %%[IF RP NAM == "Mary McCormack" THEN ]%% 
        Mary McCormack  
        %%[ELSE ENDIF]%%

    %%[ELSE ENDIF]%% 

    %%[IF RP External Wholesaler == "" AND Contact Type == "" THEN]%%
        Securian Retirement Distributors
    %%[ELSE]%%
        %%RP External Wholesaler%% 
    %%[ENDIF]%%

There's a really good chance that there is a space in there, so the "" is not being evaluated as true. Two suggestions, (the best will be based on your data) is to wrap the column calls w/Trim() or run a check on Length().

    %%[IF Trim([RP External Wholesaler]) == "" AND Trim([Contact Type]) == "" THEN]%%

Or

    %%[IF Length([RP External Wholesaler]) < 2 AND Length([Contact Type]) < 2 THEN]%%

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.