How to set variable value in Personalization Block using Embedded JavaScript (EJS)
Hi,
I am working on an email templating project in which I am trying to set a variable value in Personalization Block through Embedded JavaScript(EJS) Syntax.
The issue I am facing is that I'm unable to set the value in variable. Upon rendering it is simply displaying the text. For example:
Code:
<% var subject = %> <?= cms.subject ?>
Rendered in Personalization Block

Scenario:
I am working with Contentful(Headless CMS) which is linked with Adobe Campaign. I upload the HTML with Embedded JavaScript (EJS) template on Contentful and from there I push the code to Adobe Campaign Personalization Block. Once the code is rendered so it looks something like the above screenshot as shown.
I tried using the below code but it doesn't work
<% var subject = "<?= cms.subject ?>" %>
because it throws an error, when I upload the document on Contentful, by stating that it cannot find the closing tag "<?". So somehow I need to achieve this by concatenation or I would say by extracting input element attribute value like below, so I can easily assign the value in variable.
<input id="emailInput" value="<?= cms.subject ?>" type="hidden" ></input>
Can anyone help to set this value ?
Thank you