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
0answers
24 views

Unable to upsert Data in Data extension

I am not able to upsert data using the following code.:I am getting parameters from the URL and using them to update the DE. Now the issue is either i can make excutioncontexttype= get or post not not ...
1
vote
1answer
45 views

Always 2500 rows found in the filter

I am using the following script (in Automation Studio as a Script Activity) to remove all the rows of the last 30 days from a DE. The automation is run daily. I log errors and messages in a DE called ...
3
votes
1answer
48 views

Removing a row from a DE with Ampscript or SSJS in a landing page works, but the page shows an Internal Server Error (500)

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 ...
5
votes
1answer
83 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
56 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
17 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
32 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
33 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....
1
vote
1answer
64 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
2answers
108 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
70 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
44 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 ...
3
votes
0answers
45 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 ...
2
votes
1answer
41 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
24 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 ...
0
votes
1answer
46 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 ...
1
vote
1answer
44 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
16 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
25 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 ...
0
votes
1answer
70 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
107 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
28 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 ...
0
votes
0answers
35 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
44 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
53 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
39 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
43 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
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 ...
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: &...
1
vote
0answers
50 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
82 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
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
109 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
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 = "...
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 ...
0
votes
1answer
60 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
54 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 ...
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....
1
vote
1answer
42 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
61 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
69 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
58 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
47 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
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 ...
1
vote
2answers
103 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
59 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
93 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)...