Hi team,
I have to check if the option value is 0 my email template prints "Hi" and if the option value is 1 it prints "Bye". this scenario I want to be achieve in an email template not using a Personalization block.
My code below:
<%
var A = "<%@ include option='test' %>
if (A == '0')
{
<p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">hi</span></b></p>
}
else
{
<p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">bye</span></b></p>
}
%>
error:
01/18/2024 3:00:53 AM Failed Unreachable xxx Error while compiling script 'content htmlContent' line 8: illegal XML character (line='var A = <%@ include option='test' %>;\ ' token='%@ include option='test' %>;\ '). SCR-160032 Javascript: error while compiling script 'content htmlContent'. JST-310007 Unable to compile script (content htmlContent).
@ParthaSarathy please help on this
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @Kumar_27 ,
Please try by adding the below code in the Script Tab of your Reccuring Delivery
var test="";
if(getOption("yourOptionName") == 0)
{
test=0;
}
logInfo("test var value"+test)
and in your Reccuring delivery , Please use the below code snippet
<% if(test = '0' ) { %><p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">hi</span></b></p><% }
else { %><p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">bye</span></b></p><% } %>
Regards,
Pravallika.
Hi @Kumar_27
Could you try defining the variables [var A = <%@ include option='test' %>]under the script tag <script> ..... </script> in your HTML code and use the below code in your body tag.
<%
if (A == '0')
{
%>
<p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">hi</span></b></p>
<%
}
else
{ %>
<p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">bye</span></b></p>
<%
}
%>
Thanks,
Akshay
Views
Replies
Total Likes
hi @AkshayAnand
I got the below error while I tried the above method.
Error while compiling script 'content htmlContent' line 7: A is not defined. SCR-160012 Javascript: error while evaluating script 'content htmlContent'.
Views
Replies
Total Likes
Hi @Kumar_27 ,
Please try by adding the below code in the Script Tab of your Reccuring Delivery
var test="";
if(getOption("yourOptionName") == 0)
{
test=0;
}
logInfo("test var value"+test)
and in your Reccuring delivery , Please use the below code snippet
<% if(test = '0' ) { %><p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">hi</span></b></p><% }
else { %><p><b><span style="font-family: 'Times New Roman'; font-size: 16px;">bye</span></b></p><% } %>
Regards,
Pravallika.
Views
Likes
Replies