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
1
vote
1answer
52 views

Retrieve data for another BU

I have a cloud page in one BU. And i need to retrieve data from DE in another sibling BU (and DE is not in the Shared folder). I wrote this code, but it does not display anything. Can anyone help me ...
1
vote
1answer
208 views

Parse JSON into Data extension

Essentially, I am wanting to pass the below request body and in cloud page, add to a data extension but unsure how I might be able to achieve this. { "id": "id1", "formid"...
1
vote
1answer
135 views

SSJS RegExp.exec() works different - why?

Once again, I try to understand why SSJS in SFMC is acting differently compared to JS. Based on the following sample: RegExp.prototype.exec() SSJS Example: <script runat=server> var str = '...
1
vote
1answer
256 views

WSProxy to retrieve all data extension across all business units

I have the following SSJS function which uses WSProxy to return an array of all data extensions across all business units, however, when I test the script in a CloudPage (in a child BU), it returns ...
1
vote
2answers
67 views

How can I reactivate users that have been unsubscribed using LogUnsubEvent() in the same script?

I'm attempting to use the LogUnsubEvent() to mark the user as unsubscribed in the tracking job, but don't want the user to actually be unsubscribed from the All Subscribers.I'm sending from a Sendable ...
1
vote
1answer
85 views

Retrieve mobilepush contacts

Is there a way to retrieve SFMC mobilepush contact data/activity history data via ssjs/script that is generated in automation studio? For example, mobile contacts who are opted in who have been in a ...
1
vote
1answer
82 views

Delete contacts through rest api

I am trying to automate the deletion of contacts based on a data extension. I am using this script but it keeps giving me the error "ERROR: Error has occurred". Any idea what I might be doing wrong? ...
1
vote
1answer
437 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 ...
1
vote
2answers
292 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
36 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
1answer
390 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 ...
1
vote
1answer
115 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" ...
1
vote
2answers
300 views

Trigger ImportDefinition through WSProxy

I made a script (SSJS) to create a new Import Definition in Marketing Cloud. That works well, and if I then trigger the import manually in the GUI the import successfully completes. However, I also ...
1
vote
1answer
106 views

HTTP POST Request error “Unable to retrieve security descriptor”

When attempting to make a HTTP POST Request in server side javascript I keep getting this error, not sure what the problem is but I cant seem to fix it. <script runat="server" language="...
1
vote
1answer
490 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 ...
1
vote
2answers
366 views

JSON call using SSJS to populate a dropdown list in HTML and pass it through using AMP

I have a JSON object full of County names and I want to call it using SSJS then populate a dropdown list in HTML using the Data from the JSON. JSON looks like this [ "AZ - Maricopa", "AZ - ...
1
vote
1answer
176 views

Fetching more than 2500 records returning null for everything but correct amount of records

So I am attempting to write code that returns more than 2500 records so that I can use the data for display on the page (I know this will be slow but it is business' requirement). There are currently ...
1
vote
2answers
542 views

SSJS Error - Retrieving data from two DataExtensions and want to update the initial DataExtension

Anybody an idea what is wrong with this script? It is my first SSJS script in the automation studio but I just get the error message: An error has occured. I got the functions from the documentary. ...
1
vote
1answer
460 views

Deleting records in sales cloud using REST api

I am trying to delete multiple records using REST Api. var contentType = 'application/json; charset=utf-8'; var headerNames = ["Authorization"]; var headerValues = [("Bearer "+sessionId)];...
1
vote
1answer
281 views

how to get the textbox value entered and call the function on keypress in ssjs

I am trying this in SSJS. I have a textbox. What I need is when the user enters any data in the textbox I need to take that value, search in the DE and display a list of matching data. So how can I ...
1
vote
1answer
186 views

Using Journey Context data in email

Is there any way to retrieve a Journey's context data (definitionInstanceId, journeyId) using AMPscript, GTL or SSJS in an email ?
1
vote
1answer
173 views

Type of html emails in the system regarding API

We are creating HTML Emails and I want to get the content of them by SSJS but the problem is their type is not "Email" or "ContentBlock", it is like in the middle of those. I can retrieve their IDs, ...
1
vote
1answer
433 views

How's the performance differences between SSJS and AMPScript in Automation Studio?

I'm planning to process >100K records in a DE table using automation studio. I can write the correct logic using SSJS. However, I found out the performance of SSJS is really poor and always get ...
1
vote
1answer
807 views

Pulling Subscriber Status from Lists using SSJS

I am looking to pull the status of a subscriber whenever they click on the profile center URL link within emails. I have created a custom profile center that pulls all of the lists that I have created ...
1
vote
1answer
50 views

Grabbing email for Custom Profile Center

I am looking for a way to grab the email of the person that clicks on the %%profile_url%% to access the custom profile center I am building. I have every other functionality working by grabbing the ...
1
vote
1answer
206 views

Is there a way to do PATCH request with Marketing Cloud AmpScript or SSJS?

In Marketing Cloud AmpScript and SSJS, there is are no references for PATCH request. I wonder if we are able to make PATCH request? I'm trying to update a mobile connect record and I'm able to do so ...
1
vote
1answer
223 views

how to retrieve values passed from MicrositeURL for use with SSJS

I am building a custom preference/unsubscribe center in Cloud Pages with SSJS. I'll be using MicrositeURL('xxxxxx') within the footer of emails to get to the landing page. How can I retrieve the ...
1
vote
1answer
144 views

Retrieve All Content Areas in a Parent Folder

I've got a simple landing page that is serving as a content reference directory so I can easily look up all content areas without going through each folder. Unfortunately, the number of content areas ...
1
vote
1answer
926 views

How to resubscribe a subscriber which is already unsubscribed from All Subscribers List

I have used this code to get a subscriber from particular list but I am trying to get from all subscribers list. It's not working for that. %%[ var @ll_sub,@emailaddr,@process_subkey,@subscription,@...
1
vote
1answer
589 views

Ampscript and SSJS SOAP Call and read XML

I'm trying to make a soap post and get a rowset but I think that my xpath is bad-constructed. %%[ VAR @xml ]%% <script runat="server"> Platform.Load("core","1.1.1"); var url = 'http://...
1
vote
1answer
2k views

Marketing Cloud - unsubscribe from Data Extension?

We are planning to build a custom subscription center and the idea is for the customer to pick from which types of mailings he/she can subscribe or unsubscribe. Since we don't use Lists (aside from ...
1
vote
1answer
142 views

Automated way to move emails between folders?

under Email Studio -> Content Menu item -> My Emails folder, we keep our sent emails in various subfolders (say A, B, C, D). We'd like an automated method of moving emails older than 7 days in each ...
1
vote
1answer
835 views

Accessing Substitution Strings with SSJS in Automation Studio

I'm trying to drop a file into a particular FTP folder, and run a script that needs to access the file name. I know that %%BASEFILENAME_FROM_TRIGGER%% can give you the file name minus the extension, ...
1
vote
1answer
964 views

Displaying Dataextension row values in Landing page using SSJS

I am trying to display the row values in Dataextension based on the values submitted in the landing page form .Is there any way to display the retrieved value in HTML? And the code which i tried is &...
1
vote
1answer
760 views

Adding users in a list in Exact target Marketting cloud

I am trying to add a subscriber to a custom list in my child account in a landing page using SSJS. I have followed the examples given in the Exact target support document and I could able to update a ...
1
vote
2answers
653 views

Retrieve value from XML response using SSJS in a SSJS Activity

Use a SSJS Activity I am getting a response in XML from an API call. I need to parse the XML for a specific value. Is this possible in a SSJS Activity?
1
vote
1answer
2k views

Is there a better way to delete data extension records with Server-Side Javascript?

I`m going to delete mulitiple data extension records with Server-Side Javascript, so I used function of 'Platform.Function.DeleteData' and code as following: Platform.Function.DeleteData("Map Tags ...
1
vote
2answers
1k views

How to detect browser with AMPScript in ExactTarget?

I want to keep 2 URLs to one CTA which will navigate to the AppStore or Play Store depends the platform. Is it possible by using AMPScript/Server-side JavaScript in ExactTarget?
1
vote
2answers
880 views

Use SSJS in Custom Activity

I was wondering if there is any possibility to create a Custom Activity that executes AMPScript or/and SSJS. If so, how could I read Journey context information to the SSJS? Thanks!
1
vote
1answer
503 views

Trouble Dealing With exacttarget List…without DE

We have a situation where get subscriberkey/email address from ET email and external site and i retrieve subscribers attributes IN THE LANDING PAGE (Hosted in the exacttarget) fields from the Exact-...
1
vote
0answers
23 views

Contact Deletion in Automation Studio with SSJS

Basing on the article here I prepared a code snippet to run in Automation Studio. Unfortunately we receive Bad Request(400) error for second API call everytime even though all passed parameters are ...
1
vote
0answers
29 views

Is it possible to make a Cloud page return a Status Code 400?

In the context of using a Cloud page as an endpoint for an API call, I was wondering if it was possible to make a Cloud page return content with a different Status Code, such as 400 for example. In ...
1
vote
1answer
33 views

SFMC SSL certificate in Third Party API request

I want to call a Third Party API that requires a SSL certificate. How can i use a SSL certificate for these request using SSJS or Ampscript?
1
vote
1answer
52 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
42 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
87 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
1answer
34 views

Send progress of CloudPage back to browser during AJAX request

I'm processing CSV files with a CloudPage. I upload the CSV file, then stringify the array, and send it via AJAX to another page. Previously, I had been doing this row by row so that I could show a ...
1
vote
1answer
193 views

SSJS: read response headers from Script.Util.HttpRequest object in SFMC

We need to retrieve the response headers from an HTTP GET call issued in SSJS with the Script.Util.HttpRequest function. Unfortunately, even though it seems straightforward and the task itself is ...
1
vote
0answers
88 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
53 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
3 4
5
6 7
14