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
0
votes
1answer
41 views

How to overcome 2500 SSJS limit to delete more than 2500 DE records at once?

I created a SSJS script to delete certain records from a DE which seems to work fine for less than 2500 records. But once the number of records that need to be deleted surpass 2500 records, then it ...
0
votes
1answer
88 views

Integrating an external form with Marketing Cloud using CloudPages and SSJS

I need to integrate an external form with Marketing Cloud, but it can't be done using DEManager. I'm trying to use a webhook, which posts the form data into a CloudPage, but it's not working. When I ...
0
votes
1answer
20 views

Why is SSJS Platform.Function.ParseJSON not going into catch block if JSON has bad format

I expect this code going into catch block because "hello" is no valid json. But this is not the case. Do you have any idea? <script runat="server"> Platform.Load("core","1.1.1"); var ...
1
vote
0answers
25 views

write SFMC [Script activity] [SSJS] object Properties to a DE

i my objective is to write object properties(Folder, DE , etc) to a DE , how can i achieve this? here i tried, unsuccessfully, to write folderID to DE column ID , eventually i would like gather all ...
0
votes
0answers
25 views

What is the limit of marketing cloud to add rows in a data extension at a time?

I am trying to add around 3 lacs records in data extension in batches of 2500 by calling api inside script activity below api i am using to add data in DE: https://mcdlxf0ptr61tcvgvx1g1521cg91.rest....
0
votes
2answers
37 views

How to create multiple DE's from an array using SSJS (via an Automation Studio Script Activity)

Is there a way to dynamically generate multiple DE's based on an array? Something that might look like below? And, something that generates a new variable name (see line 6 & 27 should be the same ...
0
votes
2answers
43 views

Delete rows using a date field inside a data extension

We have a data extension which has around 90 million records and we are trying to filter them out using a date field in the D.E itself for anything older than 6 months. Sp, we can't use data retention ...
0
votes
2answers
25 views

SSJS Activity of automation - Split String using javascript

I am trying to split string variable in ssjs script but my automation always turns into error below is my code to split the string: var str = '<CreatedDate>2018-10-24T04:31:00</CreatedDate&...
0
votes
1answer
39 views

Remove all rows retrieved by a filter

Using the following filter I am retrieving all the rows I need to delete from my Data Extension: <script runat="server"> Platform.Load("core","1"); var deletedCustomerDE = DataExtension.Init("...
0
votes
0answers
25 views

Unable to add data to Data Extension using Automation script Activity

I am trying add data that come from response of SOAP API to get data from list in data extension If response contains 2500 records then I am using for loop to add this data one by one in data ...
1
vote
1answer
40 views

How to fetch Query Target DE folder path using WS Proxy

I am trying to fetch all the query details in a BU and able to fetch below details Name, customerkey, targetupdatetype, createddate, modifieddate, categoryID, TargetDEname Currently Working code: &...
1
vote
0answers
42 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) ...
2
votes
1answer
58 views

SSJS Query definition - Update target Data Extension

I have a functioning code through which I update the query text through SSJS. This is working as expected. I am trying to expand on this and want to update the target Data extension as well. Is this ...
1
vote
0answers
35 views

File upload to content builder using SSJS API from MC landing page lead to 500 error?

I coded to upload image (png) to content builder from MC landing page form using HTTP.Post of SSJS. once it done, get file url from response to store in data extension. While using this page, ...
0
votes
1answer
48 views

Marketing cloud Unable to retrieve security descriptor for this frame. SSJS

I am trying to get a json object from my email template using SSJS. Here is my code: <script runat=server> Platform.Load("Core","1.1.1"); var responseContent = HTTP.Get('https://api....
1
vote
1answer
40 views

How can I obtain the Business Unit level All Subscribers Status from the Top Level Business Unit?

I'm trying to get a list of Unsubscribed subscribers at BU level, per BU in the enterprise. I've managed to find the All Subscribers ListID per BU using the following code: <script runat = "...
3
votes
1answer
40 views

WSProxy to Retriever All QueryDefinitions in Marketing Cloud

I'd like to retrieve ALL the queries in my current BU and return the results in a DE call "Queries". I've been reviewing a number of examples and pages on SS but haven't come across a simple Retrieve ...
0
votes
1answer
54 views

how to run serverside javascript [closed]

Hi I wanted to know what are the different ways by which we can run the SSJS(serverside javascript ) on SFMC. One way is to using script activity but i guess we cant track if it executed sucessfully. ...
0
votes
1answer
39 views

How to access object from MC Rest callout in SSJS?

I am calling out the the MC REST API inside my SSJS (as its the only way to retrieve the data I need). I can't however figure out how to access properties from the response body. Platform.Load("core",...
0
votes
1answer
43 views

unable to create Data extension from existing fields of other data extension

Hi i am unable to create a dynamic data extension from the existing data extension fields. I am using the following code to get that <script runat="server"> Platform.Load("core","1.2"); var ...
5
votes
0answers
54 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....
1
vote
1answer
31 views

SSJS Replace only replaces the first instance of needle

I am trying to replace all instances of - in my GUID using SSJS in Marketing Cloud. var job_guid = 'aad2c93e-0e3e-4ec5-8592-f4ff510c1d94'; var stripped_guid = job_guid.replace('-', ''); Write('giud:' ...
2
votes
2answers
57 views

Mass Update Data Extension Names

Is there a way I can mass update Data Extension names? I have a ton of them which I need to rename. Can SSJS or any API call be used?
1
vote
1answer
47 views

How can I update a Publication List status in a child Business Unit using SSJS?

The following code updates the Publication List status in the local Business Unit of the Landing Page, but I've got over 30 Business Units and I'm looking for a way to update all the publication lists ...
0
votes
2answers
51 views

SSJS Email.Retrieve function not getting emails

I am using this function to check in SSJS if my email exists using the customer key. Code: <script runat="server"> Platform.Load("Core", "1.1.1"); try { var emailKey = '...
0
votes
0answers
42 views

Marketing Cloud SSJS - does not write to DE

I have a SSJS to be used in rest api calls. It will be an scheduled call thus this is an script activity. The script automation returns a success but I do not see any changes, it should write to DE if ...
0
votes
3answers
84 views

Can we capture start and End time of an activity in automation through SSJS or SQL query in SFMC

We are currently updating our account data extension once everyday using automation studio, I was checking whether we can capture the start time and end time of the activities in automation and the ...
1
vote
2answers
66 views

Trying to trigger an automation from different Business unit using SSJS Activity

I have written the below code and created one test scheduled automation to start the automation. I didn't get any error when i did scheduled/publish the code but my automation is not starting. and i ...
0
votes
2answers
56 views

Automation change to Paused after every run

I have implemented couple of Automations which are calling each other using SSJS script. After every run of the Automations these are going back to "paused" state. This causes future executions thru ...
1
vote
1answer
85 views

Fill a DE thanks to SSJS in Script Activity using an external API

What I'm trying to do, is to fill a Data Extension using SSJS on weather column. (For the test I'm using nodeJS) Data Extension : "Weather API" weather | city name | country code (empty)...
0
votes
3answers
108 views

Assigning SSJS variable to AMPscript in a Loop

I have a requirement, I need to get all the data extension fields dynamically based on DE customer key and need to pass those fields into AMPscript to execute other functions. Below is my SSJS code: &...
0
votes
0answers
26 views

Does WSProxy support scheduling?

It doesn't seem to support the "schedule" action, and whenever I try to setup scheduling using the update verb, it processes it with no error, but no changes are recognized.
-1
votes
1answer
42 views

How to show alert in server side javascript on conditional basis?

I am using server side Javascript and fetching a column from data extension. I want to show alert on the basis of value retrieved from SSJS lookup but whenever i place alert in SSJS code i get 500 ...
2
votes
1answer
72 views

SFMC SSJS error handling - try catch

I have the following code: <script runat="server"> Platform.Load("Core","1.1.1"); try{ var logDE = DataExtension.Init("testDE"); throw "this is an error"; logDE.Rows.Add({"c1":"...
1
vote
0answers
65 views

SSJS script activity not updating Query Definition as expected

I am trying to update a query definition in Marketing cloud using SSJS script which updates the query based on the datestamp. When I run the script, I don't get any error but it does not seem to be ...
0
votes
1answer
84 views

How to access client side javascript variable in SSJS?

I am facing difficulties in showing a message. Below is the problem statement : I have six textboxes on a cloud page which stores six digit coupon code(one digit each). I am trying to show a error ...
0
votes
0answers
14 views

Unable to Create Folder under Shared Data Extension from Parent BU through SSJS Script

I am trying to create a folder dynamically under "Shared Data Extensions" in Parent Business Unit using SSJS script. But it is throwing "Error adding folder." . Do we need to enable any special ...
4
votes
1answer
93 views

Using AMPscript/SSJS to unsubscribe from a parent business unit on a CloudPage from a child business unit?

If you click 'Unsubscribe from All' on the Subscriber in the Subscriber Properties modal in the parent business unit's context or when you perform an SSJS subscriber.Unsubscribe(); on a CloudPage on ...
0
votes
2answers
93 views

Help With Access Token for Server-to-Server Integrations Using SSJS

I am using the script below <script runat="server"> Platform.Load("core","1.1.1"); var client_id = Variable.GetValue("@ci"); var client_secret = Variable.GetValue("@...
2
votes
1answer
60 views

SSJS Error retrieving the automation activities of an automation

I'm trying to use SSJS to retrieve the automation activities of an automation, using this code: var api = new Script.Util.WSProxy(); var cols = ['Name', 'CustomerKey', 'AutomationTasks']; var ...
1
vote
1answer
49 views

SSJS Post request error

I'm trying to delete contacts based on DE. So far I'm testing the code on cloud page but eventually, it will be used as part of automation. I'm successfully retrieving a token but struggle to execute ...
8
votes
1answer
131 views

Using AMPscript/SSJS how do you unsubscribe a subscriber from a child business unit?

My goal is to create a page that passes a business unit id and a subscriber key. The page sits on the parent/enterprise business unit, it will receive business unit ids from a child business unit. ...
1
vote
0answers
90 views

SSJS - Read a Data Extension after an Rows.Update

i'm now in my firsts baby steps in JavaScript on Salesforce Marketing Cloud. In my script i read one Data Extension with an DataExtension.Init("DE") and a DE.Rows.Retrieve(filter). After this, some ...
0
votes
2answers
54 views

Removing specific records from DE using SSJS script

I have a data extension that holds customer vouchers. I have different types of vouchers in that DE: WEL (welcome), BDY (Birthday) Because Birthday is a reoccurring event, i reissue Birthday ...
1
vote
1answer
69 views

How can I read a cookie via SSJS?

Is there a way to read cookie values via SSJS? setting works via Platform.Response.SetCookie(...);
1
vote
1answer
90 views

Create Filter Definition via WSProxy

I have hit a bit of a wall in this. I can create Filter Definitions via the SSJS function and via SSJS and AMPscript and SOAP API calls, but every time I try to create via WSProxy, I get the same ...
1
vote
1answer
66 views

Unable to retrieve email with WS Proxy and Email Retrieve Request

I am facing something that I can't understand. I try to retrieve all existing emails by using the WS Proxy utils but I always have an empty response. {"Status":"OK","RequestID":"cc1da13a-cee1-4aa6-...
1
vote
1answer
62 views

Marketing Cloud - Just trying to get record count of a Data Extension in SSJS

I followed part of the solution posted by @Gortonington here: How to improve this SSJS, but the following code does not reach the end of the DataExtension and unless I break, moreData always reads ...
1
vote
1answer
69 views

Getting an array column through WSProxy.retrieve

I'm using WSProxy to retrieve information about an Automation. This works fine, until I want to retrieve a column that is an array. To be exact, I would like to get the AutomationTasks for a certain ...
1
vote
0answers
73 views

Accessing contents of a file while trying to read uploaded file

I am trying to load and read a CSV file, but I want to iterate through the lines of a file in APEX rather that JS. The reason is that we expect the CSV files to be large and want to handle that job on ...