Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [ssjs]

Server-side JavaScript (SSJS) in the Salesforce Marketing Cloud allows a developer to use JavaScript syntax and proprietary platform libraries for server-side processing.

0
votes
0answers
17 views

Extracting the send context Data Extension fields using SSJS

I am trying to extract the send context Data Extension from an email thats being sent by placing the following code in the email itself: <script runat="server"> Platform.Load("Core", "1.1.1"); ...
2
votes
1answer
35 views

Using GTL to Display Data from Nested JSON Arrays

I am building an email using data passed through JSON. Here is an example of the JSON file: { "order": { "items": [ { *Other Data*, "tracking": [ { **"...
0
votes
1answer
32 views

Return all SSJS property value pairs for object?

I'm looking for one of two things. A complete reference guide for all SFMC SSJS objects, or A way to return all contents of an object so I can see what I need to use. For an example, I've been ...
-1
votes
1answer
30 views

Set User and Attributes - Marketing Cloud

I have implemented the following base collect code: <script type="text/javascript" src="//MID.collect.igodigital.com/collect.js"></script> <script> _etmc.push(["setOrgId", "MID"])...
0
votes
1answer
45 views

How to create new user using SSJS

Could some please help as where I am going wrong ,i am basically trying to create new users in marketing cloud using SSJS <script runat=server> Platform.Load("Core","1"); { ...
0
votes
1answer
69 views

Marketing Cloud SSJS: trying to automate contact deletion

with the GDPR laws in place, it's important to have the possibility to remove contacts from Marketing Cloud. I'm trying to automate the process with existing tools and am looking for possible ...
0
votes
1answer
24 views

How to give status of triggered send back as reply on api call to landing page?

I have a cloud page that a customer accesses via an api call (do not know what kind). The call holds an email address at a time. The landing page picks up the email address, does some other stuff and ...
0
votes
1answer
36 views

Fields.Retrieve() doesn't display anything

I would like to retrieve the header of a data extension using SSJS within my Landing Page. Below is my code : <script language="javascript" runat="server"> Platform.Load("Core", "1"); ...
1
vote
1answer
27 views

Get current location with ampscript or ssjs

I have functionality on a cloud page that depends on the cloud page url. I know how to Requestparameter(), but how do I get the entire url using ampscript or SSJS?
0
votes
1answer
41 views

How to use a SFMC SJS Script Activity to pull data with httpget and then store it in a Data Extension?

I have figured out how to use HttpGet to display JSON directly in an email body, but instead I want to store this JSON data from an external URL in a data extension, and then use AMPscript lookups to ...
0
votes
2answers
35 views

Clearing a Data Extension using SSJS with SOAP

I am using the below SSJS to clear out a data extension. It works well in the Parent BU but when I run it in a Child Business Unit it fails <script language="javascript" runat="server"> ...
0
votes
2answers
31 views

Retrieve Email's Text Version or Body Content

Does anyone know if there is a way to retrieve email body content without HTML tags? Or text version (plain text) of the email? The case is we need to log it in Data Extension created to track Email ...
2
votes
1answer
56 views

Can I use AmpScript to set Subscriber Status in Marketing Cloud?

A prior developer built our microsite preference center using ampscript to grab user info from SalesForce and update the Contact/Lead info depending on the user's answers. In the case where a User ...
0
votes
1answer
66 views

SSJS to call Content Block with AMPscript

Use case: Through automation studio, a script activity is use to call and reference a content area through the "ContentAreaByName" function. That content area contains AMPscript that performs specific ...
1
vote
1answer
33 views

Update Data Extension via WSProxy

I've built a CloudPage which runs SQL queries quickly without having to use automation studio. The SSJS that runs the query works perfectly, but I'm also trying to use this function to also update a ...
0
votes
0answers
38 views

SSJS Data extension creation error

I was trying to create a data extension based on the value that i get from the sync de. Could anyone tel me what exactly the issue is, in my code. When i try to run this in the automation studio ...
0
votes
1answer
71 views

AMPScript for loop and SSJS

As the subject says, I would like to use two line of SSJS code in a for loop like in the example: VAR @listAddress, @nameChosen, @Counter, @i, @AddressRow, SET @listAddress = ...
3
votes
1answer
52 views

How to translate the cloud pages based on the browser language in salesforce marketing cloud

I have been working in custom preference centre and one of the requirement is to translate the page based on the browser language. The difficulty here is detecting the browser language "Navigator....
0
votes
1answer
58 views

Storing JSON reply payload object in Data Extension

I'm successfully getting a result from an HTTP.Post call. My reply comes in a form of a JSON and looks something like this: { "Result": { "Message": "", "MessageDetails": "", "Status": 1 ...
1
vote
1answer
26 views

Marketing cloud - SSJS - Truncate Sendable DE

I have a sendable DE which i am trying to truncate . however its erroring out. The code for ssjs is <script runat="server"> Platform.Load("core", "1.1.1"); var rows = Platform....
8
votes
1answer
80 views

Handing REST API POST Exceptions using SSJS Try-Catch on a Landing Page Form Submission with AMPSCRIPT

I have an issue with a landing page containing a webform that submits input from the user and using AMPSCRIPT I make a Rest API call using the HTTPPost2 function to utilize the validateEmail resource. ...
0
votes
1answer
46 views

SSJS Rows.Lookup with multiple criteria

I want to perform lookup search with multiple criteria applied. The below code works with one condition, but I have not found the solution to add conditions. Are there any solutions for that beyond ...
0
votes
1answer
44 views

Get and format system time with SSJS [duplicate]

How do I get current Marketing Cloud system time, usng SSJS on a cloud page. This is the format I need: 11/8/2018 14:16:54 Ideas?
1
vote
1answer
36 views

Fetching more than 2500 records returning null for everything but correct amount of records

So I am attempting to write code that returns more than 2500 records so that I can use the data for display on the page (I know this will be slow but it is business' requirement). There are currently ...
5
votes
1answer
108 views

Error adding EmailSendDefinition using SSJS

Using the documentation in the SF Help docs I am trying to create send an email to a specific person using the following code: <script type="text/javascript" runat="server"> try { ...
0
votes
2answers
28 views

Improve update query SSJS block to report errors

I've just managed to make a landing page where you can enter the target data extension, update type, and query definition of a query you want to run, press submit, and run it. It uses the following ...
1
vote
1answer
55 views

Get value of URL hash using SSJS in Marketing Cloud

Is there a way to return the full URL -- including any hash values using Server-Side JavaScript in a Landing/Cloud Page in Marketing Cloud ? If the incoming URL to my page is: https://pages.email-...
-1
votes
0answers
32 views

Email Send used Data Extension via API

In a SSJS I need to know which Data Extension were used for a Send. In the Email Send Tracking UI of Email Studio, this information is present. But where I can get this information from via API. I'm ...
3
votes
1answer
44 views

What's the different between the core versions in SSJS?

I wrote a number of SSJS before, but a question that just can't sort it out: the core version. From the official document: it said: Given that the Core library has 1, 1.1, 1.2 and 2.0 versions, ...
2
votes
1answer
119 views

Using SSJS to send single email in Marketing Cloud

Is it possible to send a single email to a Subscriber rather than a whole List using the SSJS Send Mail function? My code is as follows, you can see we have to provide a List ID to send to. <...
1
vote
0answers
66 views

What's wrong with this “HTTP.Get” in SSJS?

In activities I am running this script: <script runat="server"> Platform.Load("Core", "1.1.1") var NewReq = HTTP.Get("http://samplesite.com/sample.html"); </script> It always throws ...
0
votes
0answers
27 views

Email Preview using REST API [duplicate]

I have written a SSJS code to preview the rendered email. <script runat="server"> Platform.Load("core", "1"); var url = 'https://auth.exacttargetapis.com/v1/requestToken'; ...
1
vote
2answers
45 views

SSJS Error - Retrieving data from two DataExtensions and want to update the initial DataExtension

Anybody an idea what is wrong with this script? It is my first SSJS script in the automation studio but I just get the error message: An error has occured. I got the functions from the documentary. ...
2
votes
0answers
62 views

Getting Error while try to trigger API event in Journey From Landing pages using ssjs?

I'm working on to trigger API event in journey/Journey builder from landing pages. For now, I can able to get accessToken using clientId & clientSecret and then I tried to pass subscriberkey & ...
0
votes
1answer
74 views

SSJS : Parsing URL from JSON

I have a CloudPage form which contains a Select Dropdown with a JSON-esque Value: <select id="Select_Specialism" name="Select_Specialism" required=""><option value="">Select Specialism<...
0
votes
1answer
25 views

Get ListID of a Subscriber's Publication List programatically?

Is it possible to get subscriber's ListID of a Publication List? A retrieve from _Unsubscribes gives me only AllSubscribers listID. I've tried every API from MC, I can't get that ListID. set @rows =...
0
votes
1answer
38 views

Best practice - Really complex email - use TreatAsContent()?

I am working on an email that is very very complex with tons of ampscript and SSJS covering for a lot of different scenarios. The amount of code is still increasing as we go and it holds calls to both ...
0
votes
0answers
29 views

Insert new record in a DE from a JS Activity

On a partner account when I run this code I get no records on DE. Everything is green on Automation history. Platform.Load("Core","1.1.5"); var resDE = DataExtension.Init("EXTERNAL_KEY"); resDE....
0
votes
1answer
51 views

Retreive all records which contain a certain value (Cloudpage, Ampscript and SSJS)

I want to show jobs which are stored in a data extension in Marketing Cloud on a Cloudpage. I got that working, but it only shows the EXACT value. For instance a if i put in a value "Able Seaman" will ...
0
votes
2answers
31 views

get email recipient's first and last name in Cloud Page with SSJS

I'm using CloudpagesURL(xxxx) in an email to link to a SFMC Cloud Page when the CTA is clicked. How can I get the first and last name of the email recipient in the cloudpage with SSJS? Do I have to ...
0
votes
1answer
85 views

Get Name of Data Extension with Ampscript or SSJS

I'm using a landing page with some SSJS to create several shortcut utilities for Marketing Cloud - namely copying data extensions and running single-use queries without having to save them. I've got a ...
0
votes
0answers
19 views

Digest Auth with AMPscript or SSJS

I currently try to retrieve some data from a webservice via AMPscript. I've already done that on other projects through the following AMPscrpt, which works perfectly. SET @webservice = HTTPPost2("www....
0
votes
0answers
52 views

Content Builder: Automated Image creation from URL

I want to establish an automated image creation that pulls images from URLs to content builder and automatically saves or overrides them, because i want to use these images in emails and i believe ...
0
votes
1answer
59 views

Read and manipulate Data Extension rows with JS in CloudPages

I am trying to retrieve around 2,500 rows from my Data Extension into a CloudPage so I can use it for some dynamic forms using JS. I would like to know what would be the best way to retrieve this ...
0
votes
1answer
86 views

How to load a JS library onto server in Marketing Cloud?

I want to load this CryptoJS library onto the server so I can perform encryption server side. Is it possible to achieve this? I even went as far as simply copying and pasting it all like below, but ...
0
votes
0answers
60 views

Is it possible to call a SSJS function from within a script tag with SSJS?

I am trying to do some encoding server side, and I require several external functions to do so. I have uploaded it to my profile on marketing cloud and wrote it as so, <script runat=server>...
0
votes
0answers
54 views

How to run JQuery within SSJS on Marketing Cloud?

I have a script, <script runat=server> Platform.Load("Core", "1"); var _msg = Variable.GetValue("@message"); var _secret = Variable.GetValue("@secret"); ...
2
votes
1answer
73 views

Is it possible to perform HMAC SHA1 encoding with Ampscript?

Is it possible to do this with Ampscript? Is it possible to achieve this with SSJS? I understand there is an apex function that can do this, but I am not sure it is possible to use apex with ...
1
vote
1answer
43 views

Deleting records in sales cloud using REST api

I am trying to delete multiple records using REST Api. var contentType = 'application/json; charset=utf-8'; var headerNames = ["Authorization"]; var headerValues = [("Bearer "+sessionId)];...
1
vote
1answer
41 views

how to get the textbox value entered and call the function on keypress in ssjs

I am trying this in SSJS. I have a textbox. What I need is when the user enters any data in the textbox I need to take that value, search in the DE and display a list of matching data. So how can I ...