Skip to main content

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.

290 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
15 votes
0 answers
2k views

WSProxy setClientId in Child BU does not allow execute at Parent BU

In SF Marketing Cloud, I'm trying to update a subscriber at the Parent BU Level from my SSJS in the Child BU. I created a Cloud Page at the Child BU to run the following code in order to debug faster....
Bechir's user avatar
  • 526
6 votes
0 answers
834 views

Using a Shared SSJS functions in my Automation Script Activity

Let me preface this by saying that I am not looking at cloud pages. I am looking to either use Content Blocks or other Activity Scripts to store JS functions which I can load into an Automation Script ...
JordanGS's user avatar
  • 198
6 votes
1 answer
1k views

How to feed IER (individual email result) with Tracking Triggered Send information (triggered send via API from external app)

i hope someone can help me with this problem here: i've to feed the IER "et4ae5__IndividualEmailResult__c" object in SalesCloud from Tracking data of Triggered Send. Normally with the ...
Lorenzo's user avatar
  • 61
5 votes
0 answers
277 views

Adding Fields in a Data Extension leads to resetting retention policy

I am trying to add a 'CREATED_DATE' field with a default value of current date, in my existing Data extension using wsproxy. The code runs fine and the fields gets added, however the data extension ...
Swati Mishra's user avatar
  • 1,693
5 votes
0 answers
515 views

Is it possible to make a Cloud page return a Status Code 400?

In the context of using a Cloud page as an endpoint for an API call, I was wondering if it was possible to make a Cloud page return content with a different Status Code, such as 400 for example. In ...
Ivan Razine's user avatar
5 votes
0 answers
3k views

SSJS WSProxy: Unable to retrieve security descriptor for this frame

I am trying to get a list of MobileConnect Keywords and their associated IDs using WSProxy. I have created a CloudPage Code Resource (JSON) and written the following script: <script runat="server"...
James Angus's user avatar
5 votes
0 answers
349 views

Get FilterPart of FilterDefinition in SSJS (ExactTarget)

I'm trying to fetch the FilterParts of FilterDefinitions in SSJS (for debugging now used on a landing page). var results = FilterDefinition.Retrieve({Property:"CategoryID",SimpleOperator:"equals",...
Jhu884's user avatar
  • 153
5 votes
1 answer
2k views

Failure to retrieve list subscriber attributes in a landing page using AMPScript and SSJS

ExactTarget is core edition. There are no Data Extensions, so we use Lists. Am using landing page and trying to retrieve all the subscribers attributes of the List from SSJS and AMPScript but failed ...
Jack85's user avatar
  • 499
4 votes
1 answer
328 views

automation/v1/filetransfers - patch endpoint not working

For a specific usecase, I need to do dynamic csv exports from SFMC to an external serveur (s3). the dataextract works well. I can browse a list of DE, modify 1 temporary dataextract activity (by ...
joe_le_rap's user avatar
4 votes
1 answer
659 views

Removing a row from a DE with Ampscript or SSJS in a landing page not working

I am using the below SSJS to remove a row from a data extension. <script runat="server" > Platform.Load("Core","1.1.1"); try { var ...
Adam Ridgway's user avatar
4 votes
0 answers
632 views

SSJS using NULL values in Lookup

var src_table = DataExtension.Init("test_customers"); var unhashed_dataset = src_table.Rows.Lookup(["md5_email"], [null], 50); I want to retreive rows where md5_email is empty or null. I tried [""],...
Joseph's user avatar
  • 81
3 votes
0 answers
264 views

Can't create automation with steps with SOAP API/WS Proxy

I'm struggling to create a Automation with Steps via SSJS WS Proxy. I was however, successful to create one without any step. I provided all required IDs from documentation but I get very generic ...
Mateusz Bartkowiak's user avatar
3 votes
1 answer
234 views

Print reason for SQL query failing in SSJS

I built a Microsite which staff can you use to run one-off queries without having to create an activity and then run it or place it in an automation. It works great but is very basic - when you click ...
TCassa's user avatar
  • 898
3 votes
0 answers
503 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(...
Ozareff's user avatar
  • 31
2 votes
1 answer
108 views

SSJS functions - Platform.Function.GUID() and Platform.Function.UpsertData - no records in Data Extension

Trying to use ssjs 2 functions - Platform.Function.GUID() and Platform.Function.UpsertData in the Script Activity Added Script Activity into the Automation and executed Run Once. No errors, however no ...
Luiza Zdebska's user avatar
2 votes
1 answer
131 views

Wrong formatting returned from OpenAI API

I using OpenAI's API from Marketing Cloud, and trying to get a localized response, but I'm running into formatting issues, which I don't seem to be able to solve. Here is my request: <script ...
Nikolai Hvid's user avatar
2 votes
0 answers
341 views

Trying to make API call to external server from SFMC

I'm trying to make API call to external system from a Cloud page, but when I publish I'm getting response Response:nullresultString. Is it something do with IP whitelisting or it's a code error. Below ...
Ramya's user avatar
  • 31
2 votes
1 answer
697 views

How to retrieve "Marketing Cloud Administrator" Role with WSProxy/SOAP?

Why can't I retrieve the "Marketing Cloud Administrator" Role using WSProxy or SOAP? Have tried from parent BUs in multiple SFMC instances. It's mysteriously absent. If I drop filter and ...
Adam Spriggs's user avatar
  • 30.9k
2 votes
0 answers
227 views

SSJS Script Activity Fails to Update DE

Issue: Target DE, CustomerOrders, is not updating with the expected output, OrderId and CustomerId for all Orders. However, the script runs with no errors and logs the Success DE and the Error DE. DE'...
MarquezMoore's user avatar
2 votes
1 answer
432 views

SSJS - left shift operator (<<) and 2's Complement different behaviour than in JS

I hope someone has some experience with left shift (<<) and 2's Complement in SSJS and can help me to confirm my assumption and suggest a better approach for that problem. Assumption SSJS is ...
shd.lux's user avatar
  • 501
2 votes
0 answers
1k views

CloudPage UTF-8 encoding issue - SSJS / AMP

While creating cloud pages I would like to debug the pages and don't want to wait every time somewhere between 5 and 15 minutes for the page to be re-published. That's the reason why we are using a ...
Robert's user avatar
  • 66
2 votes
0 answers
94 views

Marketing Cloud Field-Level-Encryption with SSJS not work

I want to use SSJS Script to insert a new Subscriber to the All Subscriber List in our Marketing Cloud, in which the field-level-encryption is turned on and the Email Address of the Subscriber should ...
Jialei Cheng's user avatar
2 votes
1 answer
1k views

Read all request headers on CloudPage server side without knowing their names

I need to store whole HTTP request made to a CloudPage for audit purposes. I'm able to log everything besides headers. I'm unable to read all of them with ampscript or SSJS without knowing their names ...
Mateusz Bartkowiak's user avatar
2 votes
0 answers
337 views

SSJS: Function returns value without return

I hope someone can help me to understand the following behaviour: <script runat=server> Platform.Load("Core", "1.1.1"); function test(args) { for (var i = 0; i < args.length;...
shd.lux's user avatar
  • 501
2 votes
1 answer
1k views

SSJS - Rows.Retrieve() return empty array

I tried to get all rows from DE by DE name, I got an empty array. For the test, I tried to add a new record to this DE before the read function. Edit: This is a Shared Data Extension My code: &...
DanielRomano's user avatar
2 votes
0 answers
290 views

Unable to update Publication List in parent BU

We have developed a cloud page to update publication list to update status from Active to Unsubscribe or Unsubscribe to Active. If someone select the check box and click submit. This works fine in ...
Harish 's user avatar
  • 111
2 votes
0 answers
642 views

Whitelisting Marketing Cloud for SSJS and custom Journey Builder activities

I'm trying to get Mulesoft open for data coming from the following sources in Marketing Cloud: custom Journey Builder activities server-side JavaScript (HTTP requests) Ampscript (HTTP requests) ...
Rafał Wolsztyniak's user avatar
2 votes
0 answers
727 views

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

I'm working creating a trigger API event in Journey builder from landing pages. I am currently able to get the accessToken using clientId & clientSecret, but then I tried to pass subscriberkey &...
user60922's user avatar
2 votes
0 answers
1k views

How to setup SSJS to create data extension from existing template?

My audience data extension has hidden data types, such as LongNumber and Decimal (set to more than 18 digits for example 20.15), these are fields that were appended from the audience attributes. Via ...
susaneme's user avatar
  • 133
2 votes
0 answers
207 views

Passing a PartnerProperties parameter when starting a FileTransferActivity object via SSJS

Within the Salesforce Marketing Cloud, I am attempting to run a series of Data Extract & File Transfer activities sequentially, all with a different filename (ex myFile_2018-01-01.csv, myFile_2018-...
dsimon's user avatar
  • 21
2 votes
0 answers
584 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(); ...
Matt Goldstein's user avatar
2 votes
0 answers
852 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 ...
Matt Goldstein's user avatar
2 votes
1 answer
2k views

How to set charaset as UTF-8 in HTTP GET (SSJS) method in Salesforce Marketing cloud?

I am using HTTP get method to get the data from API,But the response returned from the API is not encoded in proper format.The Same response in Postman looks perfect. The content from Postman looks ...
Manoj Chandran's user avatar
2 votes
0 answers
3k views

Refresh Filtered Data Extensions automatically

In our system we have a ftp-triggered automation that imports a file into a data extension that is the source for hundreds of filtered data extensions which will be used for sending (and of course ...
Jens J's user avatar
  • 21
2 votes
1 answer
211 views

Saving to Lists in Sub BUs in Enterprise 2.0 account

I'm working on a landing page that is serving as a profile/preference center and is hosted in the top level BU in an Enterprise 2.0 account. The page displays several attributes (first name, last name ...
Greg's user avatar
  • 61
1 vote
1 answer
60 views

(SSJS Cloudpage Error while batching records) Fetching Records: Unable to retrieve security descriptor for this frame

I have a cloudpage which serves the purpose of ejecting records from existing journey(s). The credentials are stored in a BU Package DE, so are the records in an ejection DE. Since the exit contact ...
aryashah2k's user avatar
1 vote
0 answers
58 views

Retrieve Activities that aren't being used in any Automations in Marketing Cloud

I'm cleaning unused Automations and Activities from a Marketing Cloud Account and I'm trying to find a way to retrieve the Activities that aren't being used in any Automation using SSJS. I have ...
pmleal07's user avatar
1 vote
0 answers
214 views

Does WSProxy have an Upsert Batch?

I'm looking at using WSProxy in my ssjs script to upsert multiple rows into a Data Extension. I know there's updateBatch for updating records and createBatch for inserting new records. However, I'm ...
Peter Luo's user avatar
  • 150
1 vote
0 answers
63 views

SFMC - upload contents (as a formatted JSON) to sftp

Let's say we've got <input type="file"> inside a form placed on a cloudpage and posted it using POST with our file contents as a form params to a server side. Is it possible to send ...
pincet's user avatar
  • 933
1 vote
1 answer
283 views

Using Ampscript DecryptSymmetric function within SSJS

I am trying to get access token using SSJS, but to retrieve client id and client secret I want to use an ampscript function - DecryptSymmetric. When I use this function I get '500 - Internal server ...
jjalbert's user avatar
1 vote
0 answers
278 views

Fetch form values from localStorage to SSJS script

I am trying to resolve an issue of a scenario in which two cloud pages are created, for example, Page A contains a form with multiple fields, while Page B contains SSJS code to send the data to the ...
Harshit Singh's user avatar
1 vote
0 answers
133 views

SSJS: Unable to retrieve security descriptor for this frame error

I'm trying to create a script to store values from a form on a cloud page in the SFMC database using the SSJS HTTP Post method, but I'm receiving the following error: Exception occurred: Unable to ...
Harshit Singh's user avatar
1 vote
1 answer
144 views

ERROR "Unable to retrieve security descriptor for this frame." When using WSPROXY's createitem with JSON object any tips?

So, I've been testing some use cases with SSJS and got into this error "Unable to retrieve security descriptor for this frame." which occurs with the apiAudiencia.createItem("...
Wilson Moreira's user avatar
1 vote
0 answers
214 views

Set ClientId in MC without using WSProxy?

I'm trying to impersonate ID of a subaccount without using WSProxy library but I can't find a way to do it. In WSProxy we can do like this: var prox = new Script.Util.WSProxy(); prox.setClientId({&...
Duc Le's user avatar
  • 3,710
1 vote
1 answer
2k views

How to Make API Call from SFMC Cloud page to External System

I'm trying to make API call to external system from a Cloud page, but when I publish I'm getting response Response:nullresultString:. Below the code details. Can someone please help me this. Thank you ...
Ramya's user avatar
  • 31
1 vote
1 answer
217 views

Cannot create a Data Extension using SSJS in CloudPage but same code works in Automation Studio

I have created a HTML landing page like below, which takes the input from the user for Data Extension name <html> <body> <h1> Create a new Data Extension </h1> ...
natalie's user avatar
  • 11
1 vote
1 answer
648 views

How to create a Triggered Send Definition using SSJS?

I want to create a triggered send definition using SFMC SSJS. This should be possible using either the TriggeredSend Platform object's Add method or via WSProxy. However, I can not get either to work....
Denis's user avatar
  • 11
1 vote
0 answers
768 views

Is there a way to automate (API, SSJS script, etc.) stopping the journey when the last contact exits?

I am currently working on a case where I need to work on automating to stop the journey when the last contact exits it. It would be much easier to just manually stop the journey. However, I need to ...
Hannah Kim's user avatar
1 vote
0 answers
374 views

Error from Rows.Add

I have the following script that returns the array as expected. When I go to add the "Rows.Add" aspect, I get a 500 error. I am testing the script on a cloudpage with plans to move it to an ...
Tariq McLeod's user avatar
1 vote
0 answers
85 views

Count id in Data Extension and Upsert to another Data Extension using SSJS

This question might be a basic one but I am very new to SSJS so thank you for your understanding. The data extension names JourneyA, JourneyB, JourneyC...infinity are the result of Journey Builder. ...
Ben Inm's user avatar
  • 23

1
2 3 4 5 6