Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

how to call javascript code filename in email delivery template

Avatar

Avatar
Level 1
ashajosh
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
ashajosh
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile
ashajosh
Level 1

25-08-2020

Hi Friends,i have a question and it would be helpful if i get the solution.

 

Created a javascript code with function abc() and the filename as "xyz.js".

In Campaign email delivery template i have used the below code to call the function and the javascript filename:

 

<script src="xyz.js"></script>

<%=abc()%>

 

But i am getting an error like abc is not defined.

do i need to load the file to pick the particular filename?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

102 likes

Total Posts

300 posts

Correct Reply

96 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

102 likes

Total Posts

300 posts

Correct Reply

96 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile
_Manoj_Kumar
MVP

26-08-2020

Hello @ashajosh 

 

Can you share more details on what you are trying to do with the javascript in the delivery template.

 

Calling javascript with <script> tags is not the right way in adobe campaign. You can use loadLibrary('NAMESPACE:JS_FILE_NAME')

 

Thanks,

Answers (1)

Answers (1)

Avatar

Avatar
Contributor
MVP
wodnicki
MVP

Likes

923 likes

Total Posts

1,050 posts

Correct Reply

493 solutions
Top badges earned
Contributor
Shape 1
Give Back 100
Give Back 50
Give Back 25
View profile

Avatar
Contributor
MVP
wodnicki
MVP

Likes

923 likes

Total Posts

1,050 posts

Correct Reply

493 solutions
Top badges earned
Contributor
Shape 1
Give Back 100
Give Back 50
Give Back 25
View profile
wodnicki
MVP

03-09-2020

Hi,

 

The <script/> tag is rendered client-side, and immediately stripped by every email client since its invention.

If you're trying to use a server-side include, those are unavailable to the MTA process.

You can include JS with personalization blocks (I usually do this), or by eval()'ing response from delivery query (for cross-purpose JS).

 

Thanks,

-Jon