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.

Filter by
Sorted by
Tagged with
1
vote
1answer
1k views

Trying to InsertData or UpsertData using SSJS and I getting error message “Unable to retrieve security descriptor for this frame.”

I'm working on a custom Subscription Management page using CloudPages, and I'm able to update existing subscriptions in the target data extension using SSJS just fine: var updateResults = Platform....
0
votes
1answer
383 views

Creating Query Definition with SSJS

I am trying to create Query Definition using SSJS but its not working for me. my code as follows: <script runat="server"> Platform.Load("Core","1.1") ; var queryDef = { Name : "Example ...
0
votes
1answer
281 views

Add Subscriber to Auto Suppression Lists with SOAP API

I am trying to add a Subscriber to an Auto suppression list using SOAP API. Here is the envelope I am using : <?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="http://www.w3.org/...
0
votes
1answer
207 views

How do I sort a rowset with Server Side Javascript linked with AmpScript?

I'm using AmpScript to make a custom email and I need to sort rows to display them in order of date. I saw that I can use Server Side Javascript to make this, but my variable in ampscript is a rowset, ...
0
votes
1answer
209 views

How to create content Block in content Builder through ssjs in marketing cloud

I am trying to create content block in content builder using ssjs code but I am getting error, please check below code and how to resolve the issue? <script runat="server"> Platform....
1
vote
2answers
67 views

Cloud Page - Save to Salesforce

I'm creating a custom profile page and I want to save some information in a custom object in Salesforce. How would I go about doing this? I assume I would be using SSJS rather than AMPscript. Thanks ...
0
votes
1answer
625 views

SSJS Functions in Automation Studio

I am trying to create a Data Extension using SSJS Script through Automation Studio. My script is as follows: <script runat="server"> platform.load("core","1.1"); var deObj = { ...
0
votes
1answer
292 views

Code snippet creation in Automation Studio script

I want to create a code snippet from an automation studio script activity. Implementation works perfect in a landing page. But during the automation execution I got an error: {"Status":"Error","...
0
votes
1answer
428 views

Getting Error while try to get Salesforce OAuth access token from SFMC cloudpages ssjs httppost?

Actually I try to get access token of salesforce DC from salesforce MC by SSJS Httppost I need to create a record in salesforce object From Salesforce marketing cloud pages <!doctype html> &...
0
votes
2answers
779 views

SSJS Rows.Retrieve not returning any rows

I'm having an issue where I'm unable to retrieve any rows from a DE that I know is populated inside an automation. Here is my code: <script runat="server"> Platform.Load("core","1"); var ...
0
votes
1answer
243 views

How's the performance differences between SSJS and AMPScript in Automation Studio?

I'm planning to process >100K records in a DE table using automation studio. I can write the correct logic using SSJS. However, I found out the performance of SSJS is really poor and always get ...
1
vote
1answer
388 views

Triggered Send Subscriber Relationship Issue

Is anybody able to confirm when you setup a Triggered Send Data Extension Template, it gives you the option to select a subscriber send relationship as your subscriber key, but in my case when I ...
0
votes
2answers
641 views

Marketing Cloud - why is this SSJS failing to insert a data extension?

Basically I am trying to write some SSJS that can clone the structure of DEs which is necessary in my role as a consultant and when I'm attempting to pull data out of a synchronized DE. I've got the ...
4
votes
1answer
3k views

Making a REST API call from a Script Activity in Automation Studio

We are trying to update a service cloud custom object from marketing cloud. Can we make a REST api call within a script in Automation Studio.It will be great if someone in this forum can confirm they ...
1
vote
0answers
325 views

Server side Javascript in Marketing Cloud not updating data correctly

I am trying to update data in a data extension using a SSJS activity in automation studio. I've debugged the code in a browser and everything seems to be working correctly but when I run the activity, ...
2
votes
2answers
510 views

Remove subscriber(s) from list via script

I'm pretty new at SSJS, but I'm trying to run a script in automation studio that removes a subscriber from a list via the unsubscribe function (see: https://developer.salesforce.com/docs/atlas.en-us....
1
vote
2answers
135 views

How to extract headers from data extension?

Say the table I'm working with has firstName and date as the only two column headers, with rows of data. Something like, | firstName | date | -------------------------- + Robert | 2018/01/...
1
vote
1answer
302 views

Pulling Subscriber Status from Lists using SSJS

I am looking to pull the status of a subscriber whenever they click on the profile center URL link within emails. I have created a custom profile center that pulls all of the lists that I have created ...
0
votes
1answer
100 views

Idea: Improve dynamic content blocks (VAWP-related)

Salesforce support told me i should create a case on stackexchange to get votes on this idea because they admitted it is an gap in product. Here is a link to the problem: Dynamic Content blocks ...
0
votes
1answer
176 views

List.Subscribers.Retrieve always returning 0

<script runat="server" language="javascript"> Platform.Load("Core","1.1.1"); //retrieve all lists var lists = List.Retrieve(); for(var i=0; i<lists.length; i++){ Write(lists[i]....
1
vote
1answer
249 views

MC - Script Activity - Can I add/update/upsert some content to a DE using a Script Activity?

I have a script in SSJS that works fine inside a CloudPage (I use it for debug). For some unknown reason the same script doesn't work in Script Activity inside the automaton, without any error and ...
0
votes
3answers
126 views

Download a PDF as a download popup rather than the inbuilt browser PDF viewer

I'm trying to get a PDF to download via a cloud page, so when the user accesses the page it will show them a popup to download a PDF from a URL. I have the code that achieves this but my PDF that is ...
1
vote
1answer
72 views

See if a user has subscribed to a list on landing page

var listName = ListArr[i].List.Name; var prefName = Variable.SetValue("@PrefName",listName); var list = List.Init(listName); var subbed = ""; var checkSub = ...
0
votes
1answer
163 views

Grabbing current status of Subscriber's status to a list

I am looking to see if it is possible to grab the current status of a subscriber whether they are "active" or "unsubscribed" to a list. I am creating a custom profile center that grabs all the lists ...
1
vote
2answers
311 views

How do I cancel an automation from a script being run by the automation?

I have a scenario where we want to send the same email from multiple business units every day. The email should get updated daily, but I wanted to have a check in the automations in each business ...
0
votes
1answer
26 views

Appending subscriptions with another list

I have a subscription data extension that manages a number of categories of subscriptions, for a given subscriber. Something happened where their subscription status (boolean) for certain ...
2
votes
1answer
265 views

Update Data Extension Field to NULL using WSProxy

I'm trying out the new WSProxy API for server-side javascript. I haven't been able to update a Data Extension field to NULL when it already contains a value. Let's say "Student" is a nullable field. ...
0
votes
1answer
96 views

Personalization String to HTML value

I'm trying to pass a personalization string of %%emailaddr%% to a value of a textbox. I've tried using SSJS and AMPscript but it doesn't seem to be working for me unless I have the wrong syntax. I am ...
1
vote
1answer
724 views

Making SOAP Calls via SSJS

I am trying to make a SOAP call following from the answer here : Server-Side Javascript calling SOAP API I am running this on a cloud page. When I publish it, it doesnt render (harbinger or bad ...
1
vote
1answer
413 views

Understanding Server-Side JavaScript via WSProxy with the SOAP API

I recently stumbled across the WSProxy which seems to be interesting particularly as they seem to be more convenient to use than traditional soap calls and reduce performance overhead. WsProxy ...
0
votes
2answers
457 views

SSJS Retrieve name of all subfolders within parent folder

Is it possible to retrieve name of all subfolders within parent folder using AMP script and SSJS? <script runat=server> Platform.Load("core","1"); var results = Folder.Retrieve({...
2
votes
0answers
295 views

Data from Ajax JSON POST is replaced with Cloudpages tracking script?

I should preface by saying that this is in a SFMC Landing Page and I'm trying to send form data to another cloudpage to handle it. Current code: $('form').submit(function (e) { e.preventDefault(); ...
3
votes
1answer
188 views

Rows.Remove() using simple operator

This code returns an generic error - is it not possible to use simple operators to remove rows from a data extension? <script type="text/javaScript" runat="server"> Platform.Load("core", "...
1
vote
0answers
243 views

Platform.Request.GetPostData() won't parse to json object

SSJS Landing Page access POST JSON Request payload Based on this thread. I have form that is generated by the contents of several data extensions. The contents in these are meant to be editable, so ...
0
votes
0answers
54 views

Javascript on cloudapge - 505

I'am really struggling with this part. I am trying to submit values from checkboxes into a function which gets activated when anybody clicks the button. The function opens an URL and with the values ...
1
vote
1answer
37 views

Grabbing email for Custom Profile Center

I am looking for a way to grab the email of the person that clicks on the %%profile_url%% to access the custom profile center I am building. I have every other functionality working by grabbing the ...
0
votes
1answer
264 views

SSJS - Creating HTML table from Lists pulled

Currently I am grabbing all of my public lists from Marketing Cloud and printing them out on the page, but I want to be able to print these out in a table format on the page, maybe by possibly using a ...
0
votes
0answers
156 views

SSJS - Retrieve every list a user is on with the status = Active

I am trying to get every list a user is on and having the status="Active". The script below shows every list a user is found on, but it does not filter by the status="Active". <script runat="...
0
votes
1answer
292 views

Updating List with AMPScript

I am looking for a way to update a list using AMPscript by just pressing an update button and going through all of the checkboxes that I am pulling from Marketing Cloud. This is all for a custom ...
1
vote
0answers
24 views

Custom Profile Center POST Subscriber to List

I'm looking for a starting point on how to POST a subscriber to a list so that they are able to opt-in to a list from which I grab from Marketing Cloud. I am using SSJS to grab all of the lists that I ...
2
votes
2answers
263 views

Script to delete null value rows in data extension [closed]

I am trying to create a script that deletes any rows in my data extension that have a certain field value of null. SSJS and Ampscript seem to be able to do this, but this is my first Marketing Cloud ...
1
vote
1answer
726 views

encrypt email address in a data extension

I'd like to encrypt email address in a data extension with SHA256 within marketing cloud. This will be used as a unique identifier. When the email goes into a data extension, have the email address ...
3
votes
0answers
212 views

Has anyone been able to schedule an automation through SSJS yet?

I was wondering if anyone has been able to schedule an automation with SSJS yet? I tried, and given an existing automation "automation", already created in SSJS, I have the script below: if(...
1
vote
1answer
301 views

Add delay within cloud page using Ampscript / SSJS

Is it possible to add delay within cloud page using Ampscript / SSJS? What I'm trying to accomplish is, create a record in Sales Cloud from the cloud page, wait for 5 seconds, then query the same ...
1
vote
0answers
237 views

Salesforce Marketing Cloud / Exacttarget SSJS HTTPGet Set Content Type

I use SSJS to create a Image Content Block. However, I want to automate the whole process from getting image from URL using HTTP.get(url) and Insert into Content Builder. but I am getting strange ...
1
vote
1answer
173 views

Has anyone been able to create an image and publish through SSJS yet?

I've created a server-side JavaScript activity to create an image and run in automation, which is throwing an error, but the script working well in landing page: Value cannot be null. Parameter ...
4
votes
1answer
219 views

Can my Custom Block output SSJS in into a block in Content Builder?

I'm creating a custom content block by extending content builder as described here: https://developer.salesforce.com/docs/atlas.en-us.mc-app-development.meta/mc-app-development/content-sdk.htm I'm ...
1
vote
2answers
1k views

SSJS to delete rows from a data extension via a lookup table

Is there a way to delete selected rows from a Data extension(MASTER_DE) by looking up another data extension as a lookup (to identify the subscriber keys that need to be deleted) using SSJS? I have ...
1
vote
0answers
220 views

Posting html from form to data extension via ssjs

Hi I have a form on a cloud page. Among other fields, there is a text area in which my customer wants to put text and simple html like <br> The form is posting to another cloud page where some ...
1
vote
0answers
93 views

4/21 release - change with SSJS Update Query Definition?

My fairly static SSJS code that updates a query definition started failing on 4/21 with no changes on my end. Was something changed that would cause this very straightforward code to return a value of ...