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
2answers
523 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 ...
5
votes
1answer
78 views

Caching HTTP Get calls in SFMC for emails

I've got a email which does a HTTP Get call using SSJS Platform.Function.HTTPGet, results return json and I can parse it successfully. Would the calls get cached or would a Get call happen per ...
2
votes
1answer
50 views

ParseJSON using SSJS

I am unable to extract msg from the JSON response. @returnCode works fine and I am passing it to SSJS, but then I cannot get the msg value. <script runat="server" language="javascript"> ...
1
vote
0answers
16 views

Can I improve this Custom Subscription Center that uses lists?

We have 3 subscription lists called: promotions, newsletter and pharmaceutical advice. As our client doesn't like the standard preference center, he asked us to custom-built it. So far the ...
2
votes
0answers
28 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"...
1
vote
2answers
502 views

How to resubscribe a user in Marketing cloud using SSJS?

I have unsubscribed users using logunusbevent call in a custom unsubscribe landing pages. However, I couldn't resubscribe them again if they check the resubscribe checkbox, below are the codes that I ...
1
vote
2answers
31 views

Pass values using SSJS and AMPscript on email

Firstly, I apologise - I am a beginner with JavaScript and SSJS. I am trying to send an email with a CTA button that has an url to an external page, which will prepopulate values from a DE on the form....
0
votes
1answer
426 views

More detailed error reporting for SSJS failing?

We have a script which runs in an automation which retrieves registration data from our events management platform. The automation recently stopped working, and the problem was with the javascript ...
0
votes
1answer
374 views

Submitting HTML characters to a Data Extension via Landing Page and SSJS

I have a landing page that I am using SSJS to submit form fields to a data extension. The form fields contain HTML characters (which will import to the Data Extension fine) but, trying to update the ...
1
vote
1answer
60 views

Create a Automation Studio Dashboard on a Marketing Cloud Cloud Page

I Want to Create a dashboard where all Automations and there status in the Account is displayed. old post on the topic I Want to push all Automation object data to a data extension. This can only be ...
-2
votes
1answer
43 views

How to invoke a CloudPage from inside a Custom JB Activity and pass input parameters to it?

We have some SSJS/AMPScript code embedded in a cloudpage which we want to invoke from a Custom JB Activity and pass some parameters to it as input. Please advise how we can achieve this. Any sample ...
2
votes
2answers
104 views

SSJS OAuth 2 Support?

I'm trying to obtain an OAuth 2 token through SSJS and getting a 400 error. Here's the code I'm using: <script type="javascript" runat="server"> Platform.Load("Core", "1.1.5"); var ...
0
votes
1answer
68 views

Retrieve the context of a running SSJS script

Does anyone know how to get the details of the parent automation from within an SSJS script? We are looking to develop a generic SSJS script that can be used in multiple automations, but whose ...
2
votes
1answer
34 views

Use SSJS to Retrieve ImportDefinition Results

I'm looking for a way to use SSJS to retrieve results for various ImportDefinitions. I see that one could do it with API (here), but I'm not certain how that translates to SSJS. Is there anything ...
0
votes
1answer
44 views

how to create a landing page that posts to itself and calls a SSJS function?

I am trying to implement the prunerows() ssjs function that Adam Spriggs specifies on this link, https://sprignaturemoves.com/prune-rows-data-extension-ssjs/ But i am not sure how to create a landing ...
3
votes
0answers
44 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 ...
0
votes
1answer
23 views

Loading time to read and display Data Extension rows with JS in CloudPages

I am trying to retrieve around 40,000 rows from my Data Extension into a CloudPage for an external 3rd party to consume this data. The loading time of my cloudpage exceeds 2min, and it makes a ...
1
vote
1answer
43 views

Is there a way to capture visitor's IP addresses and link clicked via AMPScript in a Marketing Cloud “Cloud Page”?

In Marketing Cloud, Cloud Pages, is there a way to be able to capture a visiting user's IP address, device, link clicked, and so on, via AMPScript or SSJS? I know this is possible when working with ...
0
votes
0answers
15 views

How to Create A filtered DataExtension using SSJS

i would like to know , how to create a DE filter programmatically using SSJS core library. often i had to create data filters based on data attributes. Thank you. Appreciate your help.
1
vote
1answer
23 views

Can't retrieve a different attribute than status from a list through SSJS

I am trying to receive a specific subscriber from a list by using the email address as an identifier. After I have this subscriber I want to print out it's subscription status. So far I am still stuck ...
0
votes
0answers
23 views

Populate input fields dynamically from a data extension?

I am trying to solve a micro preference center for a small area that needs to populate input fields from a data extension, before going through and building it with if else statements to bring in the ...
1
vote
1answer
392 views

Server Side JavaScript to create a filtered data extension?

The Salesforce documentation provides helpful examples of creating regular data extensions using SSJS, but no example for creating a filtered one. Does anyone have a code sample for creating a ...
0
votes
1answer
65 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
101 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
2answers
52 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
1answer
22 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
32 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 ...
2
votes
1answer
125 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":"...
0
votes
0answers
29 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 ...
0
votes
1answer
301 views

AMPscript List subscribe

I'm using the following SSJS to unsubscribe a contact from a list. Just wondering, how can I use the same logic to subscribe a contact to list? Can't find anything. <script runat=server> ...
0
votes
0answers
34 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
42 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
36 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
41 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("...
2
votes
1answer
70 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
1answer
43 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 = "...
1
vote
1answer
43 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: &...
3
votes
1answer
43 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 ...
1
vote
0answers
49 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
0answers
202 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 &...
1
vote
0answers
42 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
85 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....
0
votes
1answer
539 views

SSJS script does not update a Data Extension field when using running the script via the Script Activity in Marketing Cloud

I am trying to run the script below in the Marketing Cloud Script Activity to update data in a Data Extension: <script runat="server"> Platform.Load("core","1"); try { var ...
0
votes
1answer
58 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
52 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
45 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 ...
0
votes
3answers
86 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 ...
6
votes
0answers
66 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....
2
votes
2answers
60 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
64 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 ...