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.

268 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
14 votes
0 answers
1k 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
  • 516
6 votes
0 answers
614 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
240 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,646
5 votes
0 answers
372 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
329 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
  • 143
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
  • 489
4 votes
1 answer
274 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
597 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
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
4 votes
3 answers
3k views

Server-side JavaScript and JSON

I would like to extract the data from a Data Extension column and parse it as JSON and use the data as attributes in an email. How would I go about doing this? Is there a combination of AMPScript ...
k s's user avatar
  • 141
3 votes
0 answers
205 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
218 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
  • 866
3 votes
0 answers
477 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
3 votes
0 answers
585 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
  • 71
2 votes
0 answers
176 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
456 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.2k
2 votes
0 answers
202 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
340 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
  • 466
2 votes
0 answers
81 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
0 answers
295 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
  • 466
2 votes
0 answers
277 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
557 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
698 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
994 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
  • 123
2 votes
0 answers
195 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
579 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
791 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
208 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
0 answers
53 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
  • 140
1 vote
0 answers
43 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
  • 839
1 vote
1 answer
166 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
186 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
93 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
121 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
1 answer
1k 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
182 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
469 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
571 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
862 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
  • 56
1 vote
0 answers
219 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
79 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 vote
1 answer
333 views

Retrieving all Automations in a folder with a given CategoryId

I saw this question about retrieving Automation info and I can't find how to do the basic task of retrieving information about all the automations in a folder with given CategoryID (=folderID) as I ...
Luis H's user avatar
  • 31
1 vote
0 answers
261 views

Contact Deletion in Automation Studio with SSJS

Basing on the article here I prepared a code snippet to run in Automation Studio. Unfortunately we receive Bad Request(400) error for second API call everytime even though all passed parameters are ...
Piotr's user avatar
  • 11
1 vote
1 answer
432 views

SFMC SSL certificate in Third Party API request

I want to call a Third Party API that requires a SSL certificate. How can i use a SSL certificate for these request using SSJS or Ampscript?
Maycon Bruno's user avatar
1 vote
0 answers
276 views

Not so public cloud pages in Marketing Cloud

I am building a cloudpage but want to restrict it to be visible only within my company network. I have a solution and it is working. I created a DE with the list of accepted IP ranges and used SSJS ...
rajpc's user avatar
  • 49
1 vote
0 answers
666 views

Retrieve Business Units and add to data extension SSJS

I have the following SSJS function which uses WSProxy to return an array of all business units, however, when I test the script in a CloudPage, it returns an error. I'm hoping someone can take a look ...
Sanket kharwade's user avatar
1 vote
0 answers
583 views

How to wait untill UpsertData is done using SSJS?

I'm running a for loop to update some DE records. Since the LookupRows is limited to 2000 records, we sometimes need it to iterate again. Therefore the for loop is in a while loop. Rows are marked in ...
yoni349's user avatar
  • 81

1
2 3 4 5 6