Hi, I need your help.
I am trying to run an SQL statement using Javascript in the SL section of a delivery.
The code runs fine when doing a Preview, but then breaks when Proofing.
These are the errors I get when trying to send the Proof:
These are the errors I see when visiting the proof details:
This is the JS code I use in the SL, you can see from the screenshot that the preview works and pulls data from the SQL statement.
Does this mean that I cannot use SQL in the Javascript on my Subject Line or body content?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Alex,
Yes, I got it now. Thanks for clarifying.
But, as per my understanding, we can't use complex JavaScripts in the Subject Line.
Because all variables and methods of JS are not defined for Subject Line.
I tried to run some JS in the subject line and tried to fetch the data using queryDef, but got the below error :
js Error while executing the method 'ExecuteQuery' of service 'xtk:queryDef'.
And when I tried the same JS in the JavaScript Activity, it was running fine.
It means that ExecuteQuery method is not available for Subject Line, That's why I conclude that we can't use complex JS in the Subject Line. I hope it helps.
Views
Replies
Total Likes
Hi,
Can you please explain what exactly is your requirement to run SQL in the Subject Line ?
Because if you just want to Put Recipient's FirstName and LastName in the Subject Line, then just use the below syntax :
<%= recipient.firstName %>
<%= recipient.lastName%>
Now if you will preview the delivery, it won't be showing the actual first name and last name of recipient, it will just show the syntax you have written there in the Subject Line.
But, if you will actually send the Delivery, it will take the First and Last Name of the recipient. You can verify that by sending the delivery to yourself first.
Regards,
Kapil Sharma
Views
Replies
Total Likes
Hi Kapil and thanks for your reply.
I am not trying to display first name and last name on my Subject Line.
I am trying to figure out if I can run queries in the subject line to record which user received which dynamic content in Adobe Campaign.
Thus, I need to be able to run a query that saves data after my JS selects an SL to be displayed e.g. X user got Y SL.
I hope this is more clear now.
Alex
Views
Replies
Total Likes
Hi Alex,
Yes, I got it now. Thanks for clarifying.
But, as per my understanding, we can't use complex JavaScripts in the Subject Line.
Because all variables and methods of JS are not defined for Subject Line.
I tried to run some JS in the subject line and tried to fetch the data using queryDef, but got the below error :
js Error while executing the method 'ExecuteQuery' of service 'xtk:queryDef'.
And when I tried the same JS in the JavaScript Activity, it was running fine.
It means that ExecuteQuery method is not available for Subject Line, That's why I conclude that we can't use complex JS in the Subject Line. I hope it helps.
Views
Replies
Total Likes
yeah, it seems so. thanks for checking
that is an issue for us.
thus, I guess any data saving needs to happen after the delivery has gone out, maybe on a Javascript activity to save these data.
Views
Replies
Total Likes
Yes, you can store the dynamic content as per the individual recipients with the help of the JavaScript.
This surely can be achieved by the JavaScript.
Views
Replies
Total Likes
Views
Likes
Replies