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.

185 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11
votes
0answers
356 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....
5
votes
1answer
373 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 ...
5
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 ...
4
votes
1answer
252 views

Removing a row from a DE with Ampscript or SSJS in a landing page not working

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 ...
4
votes
3answers
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 ...
3
votes
0answers
50 views

How to feed IER (individual email result) with Tracking Triggered Send information (triggered send via API from external app)

i hope someone can help me with this problem here: i've to feed the IER "et4ae5__IndividualEmailResult__c" object in SalesCloud from Tracking data of Triggered Send. Normally with the ...
3
votes
0answers
626 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"...
3
votes
1answer
102 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 ...
3
votes
0answers
328 views

Has anyone been able to schedule an automation through SSJS yet?

I was wondering if anyone has been able to schedule an automation with SSJS yet? I tried, and given an existing automation "automation", already created in SSJS, I have the script below: if(...
2
votes
0answers
81 views

SSJS: Function returns value without return

I hope someone can help me to understand the following behaviour: <script runat=server> Platform.Load("Core", "1.1.1"); function test(args) { for (var i = 0; i < args.length;...
2
votes
0answers
75 views

Unable to update Publication List in parent BU

We have developed a cloud page to update publication list to update status from Active to Unsubscribe or Unsubscribe to Active. If someone select the check box and click submit. This works fine in ...
2
votes
0answers
481 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 &...
2
votes
0answers
493 views

How to setup SSJS to create data extension from existing template?

My audience data extension has hidden data types, such as LongNumber and Decimal (set to more than 18 digits for example 20.15), these are fields that were appended from the audience attributes. Via ...
2
votes
0answers
101 views

Passing a PartnerProperties parameter when starting a FileTransferActivity object via SSJS

Within the Salesforce Marketing Cloud, I am attempting to run a series of Data Extract & File Transfer activities sequentially, all with a different filename (ex myFile_2018-01-01.csv, myFile_2018-...
2
votes
0answers
445 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(); ...
2
votes
0answers
293 views

SSJS using NULL values in Lookup

var src_table = DataExtension.Init("test_customers"); var unhashed_dataset = src_table.Rows.Lookup(["md5_email"], [null], 50); I want to retreive rows where md5_email is empty or null. I tried [""],...
2
votes
0answers
3k views

Refresh Filtered Data Extensions automatically

In our system we have a ftp-triggered automation that imports a file into a data extension that is the source for hundreds of filtered data extensions which will be used for sending (and of course ...
2
votes
1answer
195 views

Saving to Lists in Sub BUs in Enterprise 2.0 account

I'm working on a landing page that is serving as a profile/preference center and is hosted in the top level BU in an Enterprise 2.0 account. The page displays several attributes (first name, last name ...
1
vote
1answer
41 views

Journey Handling: Deleted or non existent subscribers

Scope: Journey Builder Main Problem: Dealing with deleted / unsubscribed and never existent subscribers inside a journey. These kind of subscribers shall not receive emails from E-Mail Activities ...
1
vote
0answers
30 views

Retrieve User Roles or Permissions in other BUs using SSJS

I have a few users that have access to different BUs. In each BU, they have different Roles (Permissions and PermissionSets), and I'm trying to get those Permissions/Roles that each user has in each ...
1
vote
0answers
37 views

Retrieve Business Units and add to data extension SSJS

I have the following SSJS function which uses WSProxy to return an array of all business units, however, when I test the script in a CloudPage, it returns an error. I'm hoping someone can take a look ...
1
vote
0answers
65 views

How to wait untill UpsertData is done using SSJS?

I'm running a for loop to update some DE records. Since the LookupRows is limited to 2000 records, we sometimes need it to iterate again. Therefore the for loop is in a while loop. Rows are marked in ...
1
vote
0answers
77 views

SSJS In Custom Activity

We currently have a custom activity used to send SMS, we are wondering if anyone has had any success making Ampscript/SSJS accessible within a custom activity in Journey Builder. The idea here is that ...
1
vote
1answer
51 views

Obtain publishedURL via WSProxy

I'm trying to obtain the publishedUrl of every CloudPage published. With this script: <script runat="server"> // Load the Core Library Platform.Load("core", "...
1
vote
0answers
21 views

Marketing Cloud Field-Level-Encryption with SSJS not work

I want to use SSJS Script to insert a new Subscriber to the All Subscriber List in our Marketing Cloud, in which the field-level-encryption is turned on and the Email Address of the Subscriber should ...
1
vote
0answers
57 views

Journey Builder - custom activity stops journey saving

i have a very simple custom activity that is designed to pass some values to a API endpoint for execution. the activity simply launches a window with url and request body as post vars. the post vars ...
1
vote
1answer
38 views

Rendering different images based on OS (iOS/Android)

I am trying to implement the functionality of rendering different image based on the device's OS it is getting rendered on for eg: iOS, Android. I have written the below SSJS code in my Freeform block ...
1
vote
1answer
109 views

Read all request headers on CloudPage server side without knowing their names

I need to store whole HTTP request made to a CloudPage for audit purposes. I'm able to log everything besides headers. I'm unable to read all of them with ampscript or SSJS without knowing their names ...
1
vote
0answers
44 views

Import file name into DE as field value

Do you know if it is possible to 'read' a file name from a triggered automation/import activity and then use the string in the filename to populate a field in a DE in which the records from that file ...
1
vote
1answer
197 views

SSJS - Rows.Retrieve() return empty array

I tried to get all rows from DE by DE name, I got an empty array. For the test, I tried to add a new record to this DE before the read function. Edit: This is a Shared Data Extension My code: &...
1
vote
0answers
178 views

Retrieving data from a shared data extension with SSJS

I have a hard time figuring out how to adjust the code mentioned below to read data from a shared data extension. Some details about the situation: The script is executed from a child business unit ...
1
vote
0answers
90 views

GET Response containing png image in Marketing Cloud

We are using this api (get method): https://rapidapi.com/qrcode-monkey/api/custom-qr-code-with-logo In order to create QR images on the fly when sending emails to our customers from Marketing Cloud. ...
1
vote
0answers
34 views

Marketing Cloud Connect Issue when updating Salesforce Data

Until last week I was able to update information from Marketing Cloud to Sales using the following code. Since the last weekend it stopped working, anyone knows if there was any security release that ...
1
vote
0answers
128 views

Marketing Cloud SSJS update to data extension

I have a data extension that I use for a newsletter. This newsletter will consist of a monthly automation to update the DE and a journey to send emails (12 months). My DE has a number field "...
1
vote
0answers
54 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 ...
1
vote
1answer
160 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
0answers
335 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, ...
1
vote
1answer
661 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
0answers
62 views

Correctly parse JSON

I am trying to make a call to external API but I don't know how to correctly parse results. Here is the format of the response. I can correctly parse the Status, but Results is an array and nothing so ...
1
vote
1answer
119 views

SSJS Script not Looping Through

I have some code which doesn't seem to loop through the i variable incrementally... any ideas where I'm going wrong? <script runat="server"> Platform.Load("core","1.1"); var DE1 = ...
1
vote
1answer
203 views

SSJS HTTP.Post ValidEmail with requested Access Token

I am trying to make an API request in SFMC to validate email addresses, which requires first to get the Access Token. I was able to request the access token, but then the next HTTP.Post request I do ...
1
vote
0answers
26 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 ...
1
vote
2answers
209 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
667 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 ...
1
vote
0answers
78 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 ...
1
vote
0answers
263 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) ...
1
vote
0answers
184 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, ...
1
vote
2answers
682 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 ...
1
vote
1answer
191 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)...
1
vote
0answers
239 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 ...