2

I am creating a dynamic sender profile retrieving info from a content area with ampscript. The current code is based on values within salesforce.

The current content is working although when I add additional parameters for language I am receiving errors the code which is receiving errors is:

%%[
Var @n, @EN, @FR
SET @EN = "English xxx"
SET @FR = "French yyy"
SET @n = Lookup("ENT.Salesforce_User_Data", "Name", "id", LongSFID([Relationship Owner SFID]))
]%%

%%[ IF region == "Atlantic" OR region == "Ontario" OR region == "Quebec" OR region == "Western Canada" OR region == "Institutional" THEN ]%%
    %%=v(@n)=%%
%%[ ELSEIF region == "" OR region == "Default" OR region == "Discount" OR region == "Other " AND (language != "French") THEN ]%% 
    %%= v(@EN) =%% 
%%[ ELSE ]%%
   %%= v(@FR) =%%
%%[ ENDIF ]%%

When testing the display name which should be French yyy is English xxx although when replying the correct name is displayed.

1
  • I'm not seeing an error message in your question. Commented Nov 28, 2016 at 21:35

1 Answer 1

1

I think you're missing a pair of parentheses in the elseif.

Also, I'd utilize the AttributeValue() function to ensure that the language, region and Relationship Owner SFID attributes are defined.

You can use the output() function to keep from having to open and close AMPScript blocks

%%[

var @n, @EN, @FR, @region, @ownerSFID, @language

set @n = Lookup("ENT.Salesforce_User_Data", "Name", "id", LongSFID(@ownerSFID))
set @EN = "English xxx"
set @FR = "French yyy"
set @region = AttributeValue("region")
set @ownerSFID = AttributeValue("Relationship Owner SFID")
set @language = AttributeValue("language")

]%%

%%[

if @region == "Atlantic" OR @region == "Ontario" OR @region == "Quebec" OR @region == "Western Canada" OR @region == "Institutional" then

  output(concat(@n))

elseif (empty(@region) OR @region == "Default" OR @region == "Discount" OR @region == "Other") and @language != "French" then

  output(concat(@en))

else

  output(concat(@fr))

endif

]%%
1
  • I figured out the issue it was not my coding although its not as clean as yours. The issue was the email address stated as a variable for the content area which I use to for the From Email of Sender.
    – Cheryl M
    Commented Nov 29, 2016 at 16:43

You must log in to answer this question.

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