I am working on a script that will display content based on subscriber's local value from Sales Cloud. Everything works fine until the Concat function, where I am trying to include a variable, but it seems to be treated as a string. I tried with and without '', but the result is the same - I am getting the following error:
An error occurred when attempting to evaluate a ContentBlockByName function call. Function Call: ContentBlockbyName("@content") See inner exception for details. Invalid length parameter passed to the LEFT or SUBSTRING function.
My Concat function renders like this:
Content Builder\@local\@local
Content Builder\@local\@local_footer
Content Builder\@local\@local_subject
Can you please let me know how to correctly include the variable?
%%[ var @skey, @rs, @rowCount, @row, @local, @content, @footer, @subject
Set @skey = [CampaignMember:Common:Id]
Set @rs= RetrieveSalesforceObjects('Contact', 'Local__c', 'Id', '=', @skey)
set @rowCount = rowcount(@rs)
IF @rowCount > 0 then
set @row = row(@rs,1)
set @local = field(@row,"Local__c")
ELSE
set @local = "en_US"
ENDIF
set @content = Concat('Content Builder\','@local','\', '@local')
set @footer = Concat('Content Builder\','@local','\', '@local', '_','footer')
set @subject = Concat('Content Builder\','@local','\', '@local', '_','subject')
]%%
%%=ContentBlockbyName("@content")=%%
%%=ContentBlockbyName("@footer")=%%
%%=ContentBlockbyName("@subject")=%%