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
3 views

Marketing Cloud REST API - /v2/userinfo

I am trying to get the list of current Marketing Cloud Users using REST API with GET YOUR_SUBDOMAIN.auth.marketingcloudapis.com/v2/userinfo as shown below. <script runat="server"> Platform....
0
votes
0answers
20 views

how to empty a list without removing the list

According to the documentation, the SSJS function associated with the object list are : add, remove, retrieve and subscribers https://developer.salesforce.com/docs/atlas.en-us.mc-programmatic-content....
0
votes
0answers
13 views

ClaimRow functions does not renders Coupon Codes with Triggered Email

I have build a cloud page where we are asking contacts to fill in the form and once the form is filled, we will be sending an email to same email address provided in form with the Coupon Codes. I have ...
5
votes
2answers
48 views

Are there any external call out limits in Marketing Cloud?

I would like to run an SSJS script which makes callouts to a third party system (which sends WhatsApp messages). As this action will happen frequently I would like to know if there are any limits I ...
0
votes
2answers
53 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 : { ...
1
vote
1answer
58 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
2answers
47 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 ...
0
votes
0answers
35 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
41 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 ...
0
votes
1answer
44 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
1answer
26 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 ...
1
vote
2answers
73 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","...
1
vote
1answer
53 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
0answers
27 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
30 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(...
0
votes
1answer
46 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
42 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
35 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
55 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
48 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
61 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",...
1
vote
1answer
30 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? ...
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. ...
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 ...
1
vote
0answers
63 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
28 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
42 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
86 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 ...
3
votes
1answer
52 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 ...
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"...
0
votes
2answers
64 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 ...
1
vote
1answer
76 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/...
0
votes
1answer
75 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
107 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="...
-9
votes
3answers
120 views

How to use trim() function in SSJS using data extension in Marketing Cloud [closed]

How do I use trim() functions in SSJS? Using Data Extensions. Can you please provide some examples? I have a Data Extension, where "Message" is an Attribute. In this Attribute how do I use the trim(...
0
votes
2answers
46 views

Unable to retrieve security descriptor for this frame error in HTTP POST request SSJS marketing cloud

I am trying to post a request to my site and I am using SSJS HTTP post method. But the POST request is throwing error "" Unable to retrieve security descriptor for this frame. Im not sure what i ...
3
votes
1answer
54 views

How Can I Programmatically Update Multiple non-sendable DEs to be Sendable?

I have a cleanup I'm working on and hitting a wall. We use email address as the subscriber key. I have a few hundred DEs with an "email" column that are NOT marked as sendable. I want to update them ...
1
vote
1answer
62 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 ...
0
votes
1answer
63 views

SSJS and AMPscript

I'm trying to output message if there is an error and i have very little knowledge in javascript in general. Could I get some feedback on if the following would work or how I would go about : If ...
0
votes
0answers
121 views

The 'Content-Type' header must be modified using the appropriate property or method.\r\nParameter name

I am making a Http get request to 3rd party api using SSJS. each time i make a call is get below exception: e: {"message":"An error occurred when attempting to evaluate a Util.HttpRequest call. See ...
-4
votes
1answer
55 views

How to create a task for Salesforce cloud crm using ampscript [closed]

Please advise how to create a task for Salesforce object in MC using ampscript.please let me know is this functionality is achievable Regards Shiva
0
votes
1answer
81 views

How to insert csv file record inside data extension from cloud page?

I have created a cloud page where I have provided browse button and after selecting CSV file I am reading CSV file in the script so there are 100 contact records in csv and I am sending WhatsApp ...
1
vote
1answer
36 views

Status of adding data extension with SSJS

I am using Add() function to add a new data extension and I would like to access a status message if possible. I am using following code var deObj = { "CustomerKey" : "demoDE", "Name" ...
0
votes
1answer
41 views

ParseJSON Error for HTTPPost - SSJS Unable to retrieve security descriptor

In my marketing cloud, landing page. Getting the error "System.InvalidOperationException: Unable to retrieve security descriptor for this frame" while trying to Parse the JSON response in a HTTP Post ...
4
votes
1answer
129 views

Identify the Type of an Automation Activity using SSJS WSProxy

I'm trying to create an API call that will return the SQL Code from all Query Activities within an given Automation. Using the information provided in this question Retrieve multiple tasks in an ...
1
vote
1answer
111 views

Is it possible to create Script Activities through Marketing Cloud API?

I am developing an application to interact with our Marketing Cloud and I would like to be able to create custom Script Activities(containing SSJS API calls)through the API for each campaign so I can ...
-2
votes
1answer
48 views

ParseJSON array [closed]

I am trying to achieve the following. I have JSON with array: apicall = { "CallID":"123", "Response":[ { "Header1":value1, "Header2":value2, "Header3":value3 } ]} And I would like to parse the ...
0
votes
2answers
48 views

How to separate json response in different variables? [duplicate]

How do I separate this response in one variable, like I required from below response URL only in one variable? However, "BE050-A28" this value is dynamic in every response. { "vehicle": { "...