0

We are nesting AMPscript into a content block to insert products into email. The AMPscript is pulling from a Data Extension where apostrophes are escaped as '

What we're trying to do is swap the ' with a regular apostrophe, and we're doing so using Replace(), but it's not working when contained in the content block but is working when pasted into an actual email

We then tried TreatAsContent but it doesn't seem to work. We've tried combining both in the content block, even at the SET statement, but no luck.

Is it possible to use Replace() in a content block and have it work within an email?

Code in Content Block:

 SET @CartProductName1a = field(@row,"CartProductName1")
 SET @CartProductName1 = TreatAsContent(Replace(@CartProductName1a,"'","'"))

Code in Email: %%=Replace(@CartProductName1,''',"'")=%%

5
  • It absolutely can work in Content Block. Are you using an HTML block, or FreeForm? Also, have you tried another character in the string to determine that it's not the function, but instead something around the character "'" that is not working? Commented Oct 3, 2019 at 17:35
  • HTML block. I have not tested another string as yet, but will do so now. Commented Oct 3, 2019 at 17:51
  • 1
    @GeorgeRosedale can you paste a code and data sample?
    – zuzannamj
    Commented Oct 3, 2019 at 18:13
  • updated the thread with sample code Commented Oct 3, 2019 at 18:19
  • 1
    tested another part of the string, and it worked just fine... I have a feeling the issue is that the HTML code is being rendered and so it can't find the character string as entered into the DE. Commented Oct 3, 2019 at 18:20

0

You must log in to answer this question.

Browse other questions tagged .