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
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 ...
0
votes
1answer
25 views

SSJS code to fetch the json response returned in the browser after authentication in Marketing Cloud

I am trying to connect My Cloud page to Google Sheets. In my Cloud Page I have embedded this code - https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get?apix_params=%7B%...
-2
votes
0answers
28 views

SSJS script to update a date field based on another date field based on days in the next month in marketing cloud [closed]

I have a requirement to update a date field (bill_date) based on 2 fields (another date field(order_activated_date) and bill_cycle field). If bill_cycle is 1 and my order_activated_date is 8/4/2021(...
0
votes
1answer
31 views

Follow-up— Retrieve SFMC Data Extension Rows, by fieldname

Follow-up to a similar question. I'd like to be able to access the rows[i] by field name, and saw something similar in another example, but I couldn't get it to work. In the code below, SubscriberKey1 ...
0
votes
1answer
38 views

Code resource GET request issues

I have a set of three pages that I developed in a development instance; HTML page, a JS code resource responsible for GET requests and a JS code resource responsible for POST requests. In the ...
0
votes
1answer
28 views

Extracting ObjectID of an Automation

I am not sure what I have done wrong but I am not able to extract the ObjectID of an Automation. Here is my code var prox1 = new Script.Util.WSProxy(); var cols = [ "Name", "ObjectID&...
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?
0
votes
0answers
23 views

SSJS Execute SQL and Retrieve Result

Within SSJS, i want to execute SQL to retrieve a filtered data set from data extensions and views. Then i want to insert that data as a payload into a destination DE. I got the second part working ...
2
votes
1answer
74 views

Connect SMFC to Github

Has anyone had any success connecting things like content builder or cloud pages to GitHub? I have been searching far and wide and have come across this amazing repository that almost does what I need ...
0
votes
1answer
93 views

Using code snippet in Exclusion Script Triggered Send

I'm trying to create an exclusion script based on the output of a Code snippet which looks like: <script language="javascript" runat="server"> Platform.Load("core",...
1
vote
1answer
31 views

Using SSJS filter NotContains

Has anyone have success of using SSJS filters to exclude data that contains a particular string? I am trying to get a list of Marketing Cloud users that the AccountUser.Name doesn't contain the word '...
0
votes
1answer
30 views

Using landing page to receive data from a callback

I am using MC Event notification Service and I created a callback (using a 3rd party site) to receive data posted back from Marketing Cloud. I want to see if I can utilize a landing page to receive ...
0
votes
3answers
66 views

ClaimRowValue In SSJS alternative [closed]

Is there an alternative to the ClaimRowValue function in SSJS? this code in AMPScript %%[ var @couponRow var @couponCode var @CustomerID set @CustomerID = AttributeValue("CustomerID") set @...
0
votes
0answers
19 views

Update Auto suppression List

I want to update the auto suppression list as a result of a query activity I used this script activity https://gist.github.com/eliotharper/d3673ce31c79e2ccd3b31843a5724f6c ` <script language="...
1
vote
1answer
43 views

Landing Page preview REST API in Marketing Cloud

We have a static landing page (no forms to submit) with some dynamic content like disclosures. The static content doesn't change much, but the disclosures do and the disclosure have all the legal ...
1
vote
1answer
45 views

Fetch the email name used in Journey via ssjs

I am trying to create a cloud page in which when I enter any journeys name with the click of a button I should get the name of all the emails used with that Journey. Some of these journeys in my ...
0
votes
1answer
47 views

Retrieve page url in SSJS or AMPScript [duplicate]

I need to get the full page url on my Cloud page. When I try to do it through window.location.href then I get null. Is there any way using SSJS or AMPScript to get the full page url?
0
votes
1answer
41 views

Update field in DE using Rows.Update with multiple search keys

I'm trying to update a field in my DE. And I want to search Row with multiple keys in method with this code: function setRegisreField(dataExtensionKey, firstKeyValue, secondKeyValue) { var ...
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 ...
0
votes
1answer
67 views

Delete individual record from Data Extension through cloud page

Very pleasure for the solution. Want to delete individual/particular records from landing page, but unable to delete. <table width="100%" cellspacing="0" cellpadding="0&...
0
votes
1answer
31 views

How to unsubscribe / Opt out MobileConnect using SSJS?

So far I found only APIs, is there a more simple code oriented way for that? Like there is to Emails with: var subObj = Subscriber.init(subkey); var status = subObj.Unsubscribe();
0
votes
1answer
28 views

Display multiple Trigger sends email names on landing page

I want to display the names of all the trigger send emails present in the account on landing page. A user should be able to select the one name from this list (Like dropdown list). I have tried for ...
0
votes
1answer
53 views

How to delete rows from DataExtension having no Primary Key, and exist in different Business Unit?

I refered this approach to delete rows from Data Extensions having no primary key. But this require to put SSJS script into every business unit. I tried with WSProxy by setting different clientId , ...
0
votes
1answer
38 views

How to use SSJS in side the email template content?

I have try to use SSJS and AMP scripts using microsite urls its successfully working. I am struck when I use directly SSJS and AMP script in inside email template. Using SSJS how to retrieve, insert, ...
3
votes
0answers
65 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 ...
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 ...
0
votes
0answers
16 views

AMPScript: Can I cast a value as a variable?

I'm doing a lookup of a data extension and bringing a name-value pair back in my code. Is there a means of casting the result as a variable name? FOR @preferencePageIndex = 1 TO RowCount(@...
0
votes
0answers
37 views

Not so public cloud pages in Marketing Cloud

I am building a cloudpage but want to restrict it to be visible only within my company network. I have a solution and it is working. I created a DE with the list of accepted IP ranges and used SSJS ...
-1
votes
1answer
32 views

Is there a best practice for the number of script activities in an automation?

I'm creating an automation that may need to have upwards of 20 script activities, in order to process 40,000+ records as there's a governor limit of 2500 in Rows.Retrieve. What's the best practice ...
0
votes
1answer
44 views

Retrieve status of automations of all child BUs from enterprise BU

Below is the code which I tried, but when the automation is erroring out the status is populating as paused, scheduled, stopped. The error status is not population. Code: <style> body, a, ...
0
votes
1answer
87 views

Lookup with SSJS in Marketing Cloud

<script runat="server"> Platform.Load("core","1.1.5"); var str = Attribute.GetValue('Test_JSON'); var obj = Platform.Function.ParseJSON(str); var val = ...
2
votes
1answer
40 views

WSProxy - is it possible to move categories / automations?

With the new year I am trying to create a fresh start by cleaning up old folders and files from our MID. It's quite a tedious job to move folders and files manually within automation studio. I am ...
0
votes
2answers
84 views

SSJS unable to Parse JSON using the Platform Script.Util.HttpRequest

For a cloud page, I have a use case, where using the Script.Util.HttpRequest/Response I get the OAuth token. Then I have another request, the response structure of which looks like below: { "...
0
votes
0answers
35 views

Deletes rows in a data extension Error SSJS

Can someone please help me? I want to delete data from Data Extensions, and I tried different variations. But unfortunately, it didn't work. For info I have so far used variant 1 without any problems. ...
0
votes
1answer
40 views

User is not unsubscribing when having + in the email

Facing an issue, I noticed some cases where users are unable to unsubscribe if they have a + symbol in the email address. Example - abc+cd@gmail.com Does anyone have the same issue before? any idea ...
0
votes
1answer
58 views

Send data from one CloudPage to Another

I have a cloudpage that register some customer infos(Fname, Lname, Id...), and theses info needs to be transferred to another CloudPage in order to display the correct Content for that Customer, I'm ...
0
votes
0answers
38 views

Need help in getting notification for Paused triggered sends

<script runat=server> Platform.Load("Core","1.1.1"); var mid = 'myorgMid'; var dev = 0; var allTriggers = 1; var alertEmailAddress = 'myemailId'; var ...
0
votes
0answers
41 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
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 ...
0
votes
1answer
36 views

Can't display child elements of ParseJSON in SSJS

I'm trying to extract data and present it in a readable format (testing this out with a public API) <script runat="server"> Platform.Load("Core","1.1.5"); var ...
0
votes
1answer
42 views

Skip over bad records in SSJS loop and continue processing

I have created this SSJS Loop, but it will stop when a record is considered "bad". How do I skip over this record to continue the process? <script runat="server"> Platform....
0
votes
1answer
59 views

How to find attribute name with the highest value from a Data Extension?

I have those attributes with number type in a DE and want to get the attribute name with the highest value from a record. This following code is what I'm trying to do that purpose, the code didn't get ...
1
vote
1answer
27 views

Rows retrieve is not working as expected in Cloudpage

I have a DE named mock_data_only and its external key is set to the same string. I've tried doing a (SSJS) rows retrieve on this DE and wasn't able to do so. In cloudpage preview there's just a ...
0
votes
0answers
29 views

Is there any way to force a Connector synchronization of an object via SSJS?

I couldn't find anywhere in the API documentation, but is there a way to, via SSJS, force an entity synchronization on an object (Connector)? The issue I'm running into is I created an automation ...
0
votes
0answers
21 views

Import Crypto JS Libraires, Generate Encrypted one and update to DE [duplicate]

Use-case: After FB leads insert into DE, i have to do a encryption on the email address and update the DE to one of the field, I have to use base64encode, HMACSHA256. i am able to retiever records(...
0
votes
1answer
107 views

Bulk delete rows from Data Extension using WSProxy

I am looking to delete rows from "ProxyTest22" data extension and trying to achieve this through WSProxy as the number of rows are in millions. I keep getting Error executing delete call.\r\...
0
votes
2answers
127 views

How to create dateadd function in SSJS by calling dateadd in ampscript

I'm trying to create a dateAdd function in SSJS by calling the dateAdd function in Ampscript. The code below works. But I cannot figure out how to make the date argument dynamic. This means the ...
0
votes
1answer
59 views

How to retrieve content block in SSJS

I'm trying to retrieve a content block for a script in ssjs. I tried already several functions but it seems not working. The scope is with a script to retrieve a content from a content area and push ...
-3
votes
1answer
35 views

Populate output of all values in the loop in SSJS

I have the following code and I would like to get all the values in that loop as output. Can someone tell me the function/process we use to get that result? <script runat="server"> ...

1
2 3 4 5
14