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
4
votes
1answer
1k 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 ...
0
votes
1answer
21 views

parsing JSON in cloud pages using ssjs

I am trying to parse a JSON which I get after doing a post call in the cloud page, The returned JSON is nested and I can't access it, I have tried the GLT but it is not working. This is my JSON : { ...
0
votes
1answer
35 views

How to add content to above email template assigned to Triggered Email

I have managed to initiate the Triggered Email using AMPscript in a Cloud page. Is there a way to pass in text content into the Triggered Send above the email assigned to the Triggered Email ...
1
vote
1answer
47 views

Add Subscriber into Auto Suppression List Using SSJS [duplicate]

I'm trying to add the subscribers from normal Data extension to 'Auto Suppression List' using the SSJS but my code below code is not working in case of auto suppression list it wokrs with normal Data ...
0
votes
0answers
37 views

SSJS HTTP.Post error: Unable to retrieve security descriptor for this frame [closed]

I am trying to update some data in client website i am using SSJS.Code given below: var obj = '{"clientId": "XXXXX",'; obj += '"isLssiAgreed": false,'; obj += '"isLopdAgreed": false}'; payLoad.push(...
3
votes
2answers
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 ...
0
votes
1answer
18 views

SSJS - Rows.Add not working as expected?

I created a landing page to test writing to a data extension using ssjs and the Rows.Add function and I keep getting the same error. An unexpected error has occurred! Error Message: Exception ...
2
votes
0answers
320 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(); ...
0
votes
2answers
45 views

Pick most repeated value via SSJS

Has anyone worked on getting the most repeated value from an array or in a loop (Lookuprows) via SSJS Script Activity? For example: Var Array = [1,2,2,2,2,3,4] The result should be 2. I tried ...
4
votes
2answers
4k views

REST API Methods in AMPScript or SSJS

Is there any way via AMPScript or SSJS to utilize HTTP methods outside of GET and POST? I have had no problem utilizing these two via the HTTPPost() and HTTPGet() functions, but have not found any ...
1
vote
2answers
2k views

SSJS Landing Page access POST JSON Request payload

I would like to POST to an SFMC SSJS Landing page using AJAX. Is there any way to access the POST JSON Request Payload using SSJS in the Landing page?
0
votes
0answers
34 views

ssjs json object on marketing cloud does not show boolean value

This is very troubling as JSON object is behaving differently in SSJS than standard JavaScript. See the example below. Referencing by array index: <script runat="server"> Platform.Load("core","...
1
vote
1answer
36 views

Retrieve pagination loop in SSJS

I wrote teh following script to get data from a data extension and then process it. I than noticed that it only gets 2500 records. I read somewhere that I need to add a pagination loop, but I couldn't ...
1
vote
1answer
30 views

How to conditionally delay a scheduled automation run in Automation Studio

I have an automation process which is scheduled to run on the first Monday of every month. This automation has a "Journey Builder Trigger" activity for injecting contacts to a journey. I need to ...
1
vote
2answers
72 views

SSJS SFMC - Attributes.Retrieve(); returning empty values

My code : var subscriber = Subscriber.Init("myemail@gmail.com"); var attributes = subscriber.Attributes.Retrieve(); Write(Stringify(attributes)); It gives me the output of : {"Name":"First Name","...
0
votes
1answer
41 views

SSJS script to update query and start automation with 3 minute wait in between each loop iteration

I have a script that have nested loops that loop through some arrays. In those loops, I have a something that updates a SQL Query Activity, then something to start an automation. What I am trying to ...
0
votes
2answers
419 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
47 views

Creates a trigger send definition in Marketing Cloud Using REST API or SSJS

I follow the link: "https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/createSendDefinition.htm" to create trigger send definitaion . I got the same response as mentioned ...
0
votes
2answers
1k views

Calling external SSJS in Script Activity

I am attempting to call an external microsite page (content type is text/javascript) in a Script activity. This external javascript contains functions to be used in multiple SSJS scripts. edit: I ...
1
vote
2answers
53 views

HTTP.Get - Need a solution for Non english xml data

I am using Server side javascript 'HTTP.Get' to retrieve Meta editor XML data. I could successfully retrieve for English documents into Salesforce Marketing Cloud. But It doesn't work for Chinese ...
0
votes
0answers
24 views

Updating Publication List of an Email Send Definition with SSJS or WSProxy

I can update the Data Extension just fine but when I add the "PubListKey" value from the documentation(here and here) the publication list is not updated. I thought it might be because it's a shared ...
0
votes
1answer
28 views

Redirect error SSJS

I am using a simple redirect operation after writing some data into data extension function main() { try { var response = processGoogleCaptcha(); var captcha = new CaptchaResponse(...
4
votes
1answer
3k views

Making a REST API call from a Script Activity in Automation Studio

We are trying to update a service cloud custom object from marketing cloud. Can we make a REST api call within a script in Automation Studio.It will be great if someone in this forum can confirm they ...
0
votes
1answer
43 views

Parsing Array JSON response using SSJS activity in the automation. not giving any output- Parsing array inside the array [closed]

<script runat=server> Platform.Load("Core","1.1.1"); try{ var newpay = Stringify({"failedRecords":[ { "customerId":"qXTjiIDaG", "productCode":"1", "journeyName":"1", ...
0
votes
2answers
41 views

Issue with passing the variable from SSJS to AMPscript

Used AMPScript and SSJS to generate an encrypted JSON message and pass this encryped JSON (payload) to the external system using a URL. However, the last line in the below code is not picking the ...
0
votes
1answer
34 views

Convert the subscriber information in data extension (Marketing Cloud) into JSON message (in email content) and send it to external system

Convert the subscriber information in data extension (Marketing Cloud) into JSON message and send it to external system - Can this be done using AMPScript or Do I need to rely on SSJS (Server Side ...
1
vote
1answer
52 views

Updating Notification Email Address in Automation

I have around 100 automations in my business unit. I want to update the error notification email address to my email address for all of them. Is there a way to do it through API or ssjs?
-5
votes
1answer
45 views

SSJS to create Import Defination in Marketing Cloud

I would like to create an Import Defination in marketing cloud using SSJS, where my source should be one dataExtenion and the traget should be another dataextension. I also want to start the ...
1
vote
1answer
46 views

SSJS SimpleOperator contains string or null

I am trying to search for records which contain either a value or is empty using SSJS using the following line but it doesn't yield any results. var Filter = {Property:"status",SimpleOperator:"IN",...
0
votes
0answers
14 views

Can't refresh content for PreHeader for a triggered email (TriggeredSendDefinition) using SSJS

I have a cloud page in place to update the email assigned to a Triggered email. I am trying to refresh the details of the Triggered email. Almost all the content is updated except for the PreHeader. ...
1
vote
1answer
28 views

Mass add attribute to all data extensions

I am trying to add a created date attribute to all of the data extensions that we have in our internal Marketing Cloud BU. We have about 1000+ and I was wondering if there is a way to accomplish this? ...
1
vote
0answers
58 views

Retrieve SFMC Data Extension Rows and Update 2nd Data Extension using SSJS

I have created two Data Extensions. I am attempting to use a Script Activity to update Data Extension B based on the contents of Data Extension A. I have attempted to do so with SSJS retrieve request, ...
0
votes
1answer
50 views

Can't print specific part of JSON using SSJS

I'm trying to retrieve a specific part (attribute Region) of JSON I receive and print it. Apparently, I'm missing something. I would really appreciate your advice. Platform.Load("core","1"); var ip ...
0
votes
1answer
530 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
27 views

How can I retrieve a list of Data Extensions in a folder using SSJS

I would like to output a list of Data Extension names (and their customer keys) from a specific Data Extension subfolder. Is this possible using SSJS?
1
vote
1answer
41 views

Inserting Into Data Extension From External Key In Another Data Extension With SSJS Not Working

I am attempting to insert data into a DE, which I create from the FuelSDK, using a Script Activity, I created as part of an Automation, in Automation Studio. The script runs, but no data is inserted ...
1
vote
1answer
60 views

Using API call in SSJS

I would like to know if we can do an API call Using SSJS. My need is to extract data from a data extension and target an end point using API call. The SSJS is unfortunlly not documented very well. I ...
1
vote
1answer
78 views

Using SSJS to randomise a string

I'm picking up salesforce marketing cloud and refreshing myself in AMPscript/SSJS. Could you give me some feedback on the following snippet? I don't have access to SFMC to test out, so I'm just ...
0
votes
2answers
61 views

How to Add a subscriber to a list using ampscript or ssjs in SMS message

I need to add a subscriber to a list particularly the All Subscriber list, for cloudpagesUrl to work since it returns a broken link if the subscriber is not in the all subscriber list. I already ...
0
votes
1answer
42 views

How Do I Send an HTTP POST API Call Through a Script Activity Using Basic Auth?

I have seen a few posts about how this can be done using oauth, but I need to use basic auth and I can't seem to get it to work. Below is an example of the code I'm using. <script type="javascript"...
3
votes
1answer
51 views

Check IBAN validity function in SSJS

I found a piece of client side Javascript code to check the validity of an IBAN bank account number here: https://stackoverflow.com/questions/21928083/iban-validation-check Now I'd like to use this ...
6
votes
1answer
152 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 ...
0
votes
1answer
1k views

Marketing Cloud SSJS: trying to automate contact deletion

with the GDPR laws in place, it's important to have the possibility to remove contacts from Marketing Cloud. I'm trying to automate the process with existing tools and am looking for possible ...
1
vote
1answer
71 views

Update Salesforce object through ampscript

I was trying to update account object through ampscript using UpdateSingleSalesforceObject this function,the result is returning zero value,is their any permission is need to be provided for accessing/...
1
vote
1answer
416 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 ...
1
vote
2answers
1k views

SSJS to delete rows from a data extension via a lookup table

Is there a way to delete selected rows from a Data extension(MASTER_DE) by looking up another data extension as a lookup (to identify the subscriber keys that need to be deleted) using SSJS? I have ...
0
votes
1answer
71 views

API call to external system to pull data to marketing cloud

Is it possible to make an API call from the marketing cloud to pull data from external system? One way to do it create a script activity and schedule it or calling the activity through API. Real ...
0
votes
1answer
21 views

Convert Reports values into numbers from strings in a script activity

I want to perform a script activity on an Account Send Summary report I dropped into a Data Extension. The current numbers inside of the system cannot be logically filtered because they contain "," ...
1
vote
1answer
99 views

Marketing cloud Contact deletion using ssjs

I am new to marketing cloud, can anyone tell me how to automate contactdeletion process using new OAuth 2.0. Using legacy the process works but not able to proceed with OAuth 2.0. <script runat="...
0
votes
1answer
129 views

Fields.Retrieve() doesn't display anything

I would like to retrieve the header of a data extension using SSJS within my Landing Page. Below is my code : <script language="javascript" runat="server"> Platform.Load("Core", "1"); ...