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
1 answer
102 views

Get complete URL with parameters in SSJS/Ampscript

Here's how to get the URL of current page (with parameters) in SSJS: var url = Platform.Request.RequestURL(); Effectively, it's the equivalent of RequestParameter('PAGEURL') in AMPscript. However, ...
Lukas Lunow's user avatar
  • 20.5k
0 votes
1 answer
54 views

Get MID from CloudpagesURL()

I am trying to create an unsubscribe page at the parent BU level for multiple child BUs. I want to use impersonatation with WSProxy in order to log the unsubscribe at the right BU, to do that I need ...
Arthur Noort's user avatar
-1 votes
3 answers
91 views

Find associated BUs for a user in Marketing cloud

Is there an automated way to find out all the associated BUs for a user? Using SSJS or SOAP API or AMPscript?
Maneesh's user avatar
  • 2,164
2 votes
1 answer
109 views

Removing 1 billion rows of a DE

As the title suggests, I need to figure out how I can remove ~1 billion rows of a Send Log data extension. I can't even change the data retention policy until the count is < 100 million. I thought ...
PForsyth's user avatar
0 votes
1 answer
48 views

ssjs System.Collections.Generic.Dictionary`2[System.String,System.Object]

I have a SSJS code that i am running SFMC cloudpages. The code is to do a HTTP.GET call to a url and then parse the JSON response.when trying to write out the result of parse i receive the following ...
sam sfmc's user avatar
0 votes
1 answer
45 views

Import lots of files from ftp to update datas extensions

I need to import 81 one different files daily, from a sftp, at a especific time, and overwrite the respectives data extensions. How do I do that without building 81 automations? How do I use ssjs to ...
Bruna Marques's user avatar
-1 votes
1 answer
53 views

Convert epoch into datetime in CloudPage

I have a CloudPage JS Resource that I use to parse a JSON. As part of the JSON, a UTC timestamp in milliseconds is provided. I want to convert that into a DateTime and save it in a DE. I've tried ...
Alex's user avatar
  • 158
0 votes
1 answer
87 views

Example of Filter Operator "Between" (SSJS)

I'm trying to use a complex filter in my WSproxy retrieve method that gets values where their date is between two dates. I'm this currently: var ThreeDaysAgoFilter = { LeftOperand:{ ...
Peter Luo's user avatar
  • 140
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
0 votes
1 answer
83 views

How Do I Break Down a JSON Array Format CSV Column Into Individual Columns Within SFMC Data Extensions?

I have an interesting use-case where I am getting a Data Extension from CDP where one of the columns is in JSON Format. Now I want to break down the last column of this DE into its individual columns....
aryashah2k's user avatar
0 votes
0 answers
78 views

Auth API calls resulting in 400 bad requests when POSTing multipart/form-data payloads with SSJS

I'm trying to make Auth API calls to an external API Endpoint from Marketing Cloud using SSJS or AMPScript but I am getting 400 bad request errors for these calls. In talks with a contact from the ...
Chris G's user avatar
0 votes
1 answer
49 views

Salesforce Marketing Cloud SSJS: Unable to fetch the HttpRequest response

I am using the below SSJS code. var req = new Script.Util.HttpRequest(eventEndPoint); req.emptyContentHandling = 0; req.retries = 2; req.continueOnError = true; //req....
Ranjan's user avatar
  • 67
0 votes
1 answer
65 views

Performing File Transfer Activities using ssjs

i am currently trying to create and and start Activites in Automation Studio and i am stuck at performing File Transfer activities. i made sure to preform a series of Data Extracts so that the files ...
Leon's user avatar
  • 3
0 votes
0 answers
58 views

Issue with adding / updating a record into a data extension via cloud page

I am trying to add / update a test record in a data extension from a cloud page but I keep getting 500 - Internal server error I have looked at the online resources and some answers here as well ...
kl2's user avatar
  • 317
0 votes
1 answer
42 views

SSJS to update query definition - stringify individual column names with loop

We have a script activity in automation studio to update the text of a query definition and target a new data extension. It currently selects all fields using the standard SELECT *, but we need to now ...
TCassa's user avatar
  • 866
0 votes
1 answer
53 views

Updating an Email Send Definition with SSJS to update data extension AND publication list

As part of an automated email we have, I made an SSJS script block to update an Email Send Definition (User-Initiated) to target a new data extension. However when we do this, it resets the ...
TCassa's user avatar
  • 866
1 vote
1 answer
81 views

Delete a subscriber off a Suppression list with SSJS

Given a suppression list, I am able to delete a subscriber from the list using SoapUI, I just pass the access token in the xml and I retrieve message 200 and the contact is deleted. However, when ...
Johhnytska's user avatar
-1 votes
1 answer
48 views

Converting Currency into USD using AMP script is not working

I tried to convert currency into USD, but instead of converting into USD it's moving to decimal place. My code is %%[ Var @num Set @num = formatcurrency("123.45678", "en-Us") ] %% ...
SFMC Developer's user avatar
0 votes
1 answer
76 views

Can we Run An Automation for 24 Hours by adding repetitive activities to ensure we are processing data we captured in Data Extension

We need to continuously process data(need to make an API call using SSJS script activity to external system which is time sensitive) which we are capturing in Marketing Cloud Data Extension via SFMC ...
JNC's user avatar
  • 39
0 votes
1 answer
62 views

Looping SSJS to output Ampscript variables partially works if I don't use a word building array function. Can't figure out why

I've got a data extension which has multiple rows for each item a user has in their cart and it's tied to their email address. The main issue is I need to cut off the product name at a max character ...
Erik B's user avatar
  • 63
0 votes
0 answers
149 views

Passing Data from Client-side JavaScript to SSJS in Salesforce Marketing Cloud

I'm trying to generate a QR code on a CloudPage in Salesforce Marketing Cloud using client-side JavaScript, then pass that QR code data to a SSJS script on the same CloudPage. The SSJS script is ...
QazWsx's user avatar
  • 3
0 votes
1 answer
141 views

Parsing data in the data extension with AMPscript

I have a data extension in Marketing Cloud with data about tasks per account per contact. A contact can be related to more than one account and can have multiple tasks in each account. I need to send ...
Julia's user avatar
  • 3
0 votes
1 answer
51 views

issue with UpsertDE "Unable to retrieve security descriptor for this frame"

I'm trying to write results in a Data Extension but this is the message response in the cloud page {"message":"Unable to retrieve security descriptor for this frame.","...
Juan's user avatar
  • 1
0 votes
1 answer
48 views

How to use a variable mapping a json

I need search the assets types in a json but mapping I have a block key that is different in all blocks. I set a variable that cointains this values but when I want to use do not retrive the things ...
Juan's user avatar
  • 1
0 votes
1 answer
68 views

How to execute journey exists in child BU from parent automation?

I need to execute a journey which is created in child BU from parent automation. The automation option is disabled in Schedule Type in the child journey even the data extension is used in the parent ...
Prasad Ruwanpathirana's user avatar
0 votes
1 answer
75 views

SSJS to send data to API

I am trying to send data with SSJS to an API but am not finding the error. I always receive the 500 error when publishing the cloudpage to test it. <script runat="server"> Platform....
Sebastian Hansen's user avatar
1 vote
1 answer
360 views

Why is my SSJS if else if else function not working?

I have an attribute field called "klantnaam". In another field called "adressen" I have a JSON array with several objects. In the object I have the following fields: adressoort, ...
Martijn e's user avatar
  • 145
0 votes
1 answer
163 views

Error Message: "Unable to retrieve security descriptor for this frame." - Get JSON Data using SSJS in SFMC

I've just started to get my head round SSJS and tried this simple script from a tutorial as the script I wrote (same logic) was erroring in the same way. I am looking to upsert data into a DE from a ...
Eddie Belhay's user avatar
0 votes
0 answers
473 views

How to insert a row in a Data Extension using SSJS?

I'm trying to add a row in a Data Extension using the following code: <script runat="server"> Platform.Load("Core","1"); try { var deRows = {offer_id:&...
Leonardo's user avatar
-1 votes
1 answer
140 views

SFMC - Automation SSJS Get filename and other metadata

Currently, I have a file transfer and file import activity in my Automation. As part of this automation, I need to get the file name and number of records in the file for Audit purpose. Based on my ...
user133411's user avatar
1 vote
2 answers
82 views

Is there a way to store a random number for using in the subjectline and HTML body?

I am using the script and modified it to my needs: %%[ /*Sets de AB */ set @modtarget = AttributeValue("_customObjectKey") if not empty(@modtarget) then if mod(@modtarget, 2) == 0 ...
Martijn e's user avatar
  • 145
0 votes
1 answer
94 views

How SSJS Script Can Be Execute Multiple times

I have a use case where I need to make a REST API call to the third-party application to get coupons. I was able to make API call and capture coupons into DE, but due to API limitations, I'm only able ...
Harish 's user avatar
  • 111
0 votes
1 answer
65 views

Unable to update a second column value in data extension using wsproxy

I want to pull a data extension DE1 where it has two columns I used wsproxy to copy these column values to another data extension where one of the two column is encrypted and another column needs to ...
Prash's user avatar
  • 1
0 votes
0 answers
73 views

API call getting 422 when pulling JSON payload from Data Extension

I am trying to pull a JSON payload that exists as a value in a field in a data extension into an API call. When I try this I am getting a 422 response. I have tried writing the value of the DE field ...
BenL's user avatar
  • 1
0 votes
1 answer
199 views

I want to search the list of SQL Query Activities which uses my target data extension in Select statements without explicitly storing them in DEs

I'm trying to display the results in the form instead of storing the details in data extension which makes it accessible for everyone with the cloudpage URL. Here the search is not happening as ...
vis_1019's user avatar
0 votes
0 answers
56 views

Writing 100k deletes SSJS in DE and applied filter to column SCD_FLG and value D. Below code got failed in automation. Any leads will be appreciated

<script runat="server"> Platform.Load("core", "1.1.1"); var config = { name: "91D16891-FEEC-4C5C-A6E9-729D7E612B5A", cols: ["OFFER_DK"]...
user132577's user avatar
0 votes
1 answer
99 views

Error trying to retrieve Automations and inserting them into a Data Extension using SSJS

I am trying retrieve all Automations from a Business Unit and insert them in a Data Extension ussing SSJS. It works fine when I retrieve them in a Cloud Page but when I try to insert them into a Data ...
pmleal07's user avatar
0 votes
0 answers
71 views

Creating a Data Extension from a data schema via SSJS

I am trying to create a page where I can paste a data schema and it will create a data extension rather than doing it all by hand. Here is what I have so far but its not working. Please advise. EDIT: ...
QazWsx's user avatar
  • 3
0 votes
0 answers
99 views

API Triggered SMS to a Data Extension

I'm trying to find a way to trigger SMS using SSJS Script Activity in the Automation Studio. The records are in the Sendable DE - is it technically possible to trigger SMS within SFMC, using API call ...
Lana K.'s user avatar
0 votes
1 answer
56 views

SSJS retrieve working but not getting all rows

I am trying to move records from a DE into a custom object using an SSJS core function script (adapted from one I found here). I have it working, but it leaves some records behind. Get's about 820 out ...
Sean Carew's user avatar
0 votes
0 answers
41 views

SSJS - Error API - SSRF detected

When trying to push a request to a specific endpoint (in a kafka topic exactly). Support team tell me to check for whitelisting SFMC Ip Addresses, it was already done. This same Request works in ...
Mahmoud Gueye's user avatar
0 votes
0 answers
133 views

Is there a way to run SSJS as async?

We need to make thousands of API calls to 3rd party server. I was planning to do so using script activity in the automation studio. But, since SSJS and AMPScript are synchronous this can take hours ...
yoni349's user avatar
  • 81
0 votes
1 answer
150 views

Encrypt fields subscriberkey and email address in the url using a key to send a cloud page in ssjs/amp script

I have 2 cloud pages and I'm navigating from 1st to 2nd (where I'm doing some additional processing). Now the problem is that my 2nd cloud page needs field values from page1 which is subscriberkey and ...
Jimmy Vaswani's user avatar
0 votes
0 answers
17 views

Can I run a query activity from a cloudpage? [duplicate]

is it possible to run a query activity from a cloudpage? And how can I achieve this?
Martijn e's user avatar
  • 145
-2 votes
1 answer
189 views

Create an survey where the pages in the survey will be navigated based on the response in previous page [closed]

I am new to MC and I am given the task to create a survey where the questions will be posted to the end-user. The questions in the survey should get navigated based on the response in the previous ...
Rahul Allada's user avatar
0 votes
1 answer
65 views

Create a list of Data Extensions that are being used in Filter Activities in Marketing Cloud

I need to create a list of Data Extensions being used in the Filter Activities in Salesforce Marketing Cloud. I tried using the FilterDefinition but I am not getting any results. I am using the ...
pmleal07's user avatar
0 votes
1 answer
316 views

Protecting Cloud Page with Login Form (SSJS)

I am looking to protect a cloud page with a login page. i have written this SSJS for the page to be secured: <html> <head> <script runat="server"> Platform.Load("...
QazWsx's user avatar
  • 3
0 votes
0 answers
57 views

Custom pref center using WSProxy

I just start learning WSProxy and I'm trying to build custom preference center in SFMC for multiple publication lists so I started with 2 test publication lists test1, test2. I use if else statement ...
Mohammad's user avatar
1 vote
1 answer
100 views

Create list of Data Extensions that are being used in Data Extension Extracts in Marketing Cloud

I need to create a list of Data Extensions being used in the Data Extension Extract Activities. I tried using the ExtractDefintion but I haven't managed to make it work. https://developer.salesforce....
pmleal07's user avatar
1 vote
1 answer
115 views

it is possible to process ampscript SSJS

Can I process an SSJS AMPscript? If I receive a string "AMPscript" can I give it a context and SSJS will process it? in the provided code I am trying to take a string like this %%=FormatDate(...
SpinXO's user avatar
  • 25

1
2 3 4 5
19