Home / taxonomy / term / SSJS / SSJS / SSJS


0 points
david.atwell's picture

Hello!  I'm trying to make SSJS send out a TSD.  This is my basic proof-of-concept, but it isn't working:

<script runat="server" language="JavaScript">




var tsd = TriggeredSend.Init(" ((External Key of TSD)) ");

var status = tsd.Send(" ((my email)) ");









Sending a TSD with Server-Side JavaScript

0 points
JosiahKaiser's picture

I am getting a very frustrating error trying to use the indexOf() method on an array. Even with the super-simple code below, I get an error, "Jint.JintException: Object expected: indexOf"

var y = new Array;

y = ["a","b","c"];

var x = y.indexOf("a");


Any thoughts?

Does SSJS support indexOf() Method on Arrays?

177 points
kimmitchell@expedia.com's picture


I'm trying to find some code online that will work on a microsite to convert a string I pass in from ampscript to a SHA-1 hash. It has to be SHA-1 (not SHA-256 or 512). Please advise.

Microsite code that works with ampscript and converts a string to a sha-1 hash

331 points
jsakas's picture

I am unsure why this code is not working:

Platform.Load("Core", "1")
var countsDE = DataExtension.Init("FINAL_CR_INVALID_MACHINE_COUNTS");
var data = countsDE.Rows.Retrieve();


In the ET docs it says this should work:



SSJS Rows.Retrieve() not working properly

265 points
spriggsa's picture

I'd like to display an email's thumbnail dynamically in a landing page using AMPScript or SSJS -- much like what's described in this post:


Can this be done?



Retrieving a thumbnail image of an email via AMPScript or SSJS?

0 points
JR's picture

Hi All,

Our client has the requiremnt that they are able to Update Values in a data Extension via some User Interface. I do not know of an out of the box way of doing this so I built one using SSJS & AMPScript. It works great as long as the result set is not to large.

How do I limit the number of Rows from an SSJS Retrieve Rows

331 points
jsakas's picture

We know it is possible to pull field information on a specific DE using SSJS. However, I have not found a way to determine the DE type information: If the DE is sendable, which field is for email and how it relates to subscribers. Is there a function for returning this info into a JSON object similar to the Fields.Retrieve function? 

SSJS to retrieve DE type & sendable info

0 points
JR's picture

Hi Guys,

I need to update a DE Date Field with an empty value. I have tried usign the following code with several options for the unusb date but they all produce 01/01/1900 12:00:00, this is a problem as I have to code around that date value and explain to the client whey the date is not empty...

UnsubDate = Items[i].Value ? "" : new Date();
result = de.Rows.Update({ UnsubDate : UnsubDate }, ["EmailAddress", "CampaignID"],[emailAddress, Items[i].CampaignID]);


Update DE Date Filed with Empty causes 01/01/1900 help...