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
1 answer
172 views

Using MC Data Extension to update HTML on Landing Page [closed]

Is it possible to pass HTML code through a Data Extension value to set the HTML for an AmpScript Landing Page?
Austin's user avatar
  • 1
0 votes
1 answer
81 views

Can I add a list of same content block and update each content block's item based on a HTTP request?

I want to send email to my customers in SFMC. The email contains a list of products. The data of products comes from a HTTP request, and the HTTP response is a JSON object. Now I've developed a ...
XWang's user avatar
  • 103
0 votes
0 answers
93 views

Data Extract definition change filename pattern

Can I programmatically change Data Extract definition? I cannot find any example. I am looking for something similar to QueryDefinition change example: var qd = QueryDefinition.Init('my_definition'), ...
martechnotes.com's user avatar
0 votes
1 answer
395 views

UpsertDE function not working on Shared Data Extension using SSJS from child BU even though used ENT

I want to use UpsertDE function on Shared Data Extension using SSJS from child BU. Even I tried ENT. before DE name, I have received 500 error in cloud page and script activity is getting errored in ...
SFMCuser's user avatar
0 votes
1 answer
179 views

Using SSJS to report on email sends using the Single Send ID as a URL parameter

Im looking to set up an API that retrives all the email send stats eg. Open Rate, Click rate, Unsubscribes etc... I have set this up before but cannot remember how unfortunately. It would return a ...
DA101's user avatar
  • 3
0 votes
1 answer
236 views

Is it possible to pause an automation that is already running using SSJS in SFMC?

I have created an SSJS script which aims to start and stop mass automation. While both functions work normally, I noticed that when an automation is already running and I run the script, it does not ...
themis tsoupros's user avatar
0 votes
1 answer
529 views

How to retrieve JSON values from a Data Extension

I have a basic javascript for retrieving values. Like this: <script runat="server"> Platform.Load("core", "1.1"); var list = ["value1",&...
Martijn e's user avatar
  • 145
0 votes
1 answer
115 views

Is it possible to retrieve Cloud Page User's Time zone?

I am trying to retrieve the time zone from a cloud page to populate and ICS file I am generating. The file is created fine, but the time is incorrect. Is it retrieve to pass the user's time zone so I ...
Tariq McLeod's user avatar
1 vote
2 answers
959 views

SSJS to pause and start an automation || Run automation for specific duration and frequency

I have to create an automation in Salesforce Marketing Cloud to run every day from 8am to 10pm but unfortunately the schedule configuration does not have this option. I heard that it is possible to ...
Jerry's user avatar
  • 11
1 vote
1 answer
167 views

Using Ampscript DecryptSymmetric function within SSJS

I am trying to get access token using SSJS, but to retrieve client id and client secret I want to use an ampscript function - DecryptSymmetric. When I use this function I get '500 - Internal server ...
jjalbert's user avatar
0 votes
2 answers
141 views

Cannot Perform action on TriggeredSend object via WSProxy?

I'm trying to perform an action (Start, Pause, Publish) on a Triggered Send via WSProxy but with no success so far. <script runat="server"> Platform.Load("core", "1.1&...
Duc Le's user avatar
  • 2,603
0 votes
1 answer
193 views

What happened to my microsites in SFMC? Classic Content discontinued

I used to have a very useful microsite, available only to logged-in users, which updated a query definition in Automation Studio via SSJS and ran it without needing to go through the Automation Studio ...
TCassa's user avatar
  • 866
0 votes
2 answers
887 views

SSJS & AMPscript in Script Activity updating SF object and logging errors into DE

I'm trying to update SF object (Lead) with 3 values in Script Activity in Automation Studio and also logging errors into DE but my code constantly fails. I added Catch/Try blocks but it didn't help ...
maria's user avatar
  • 1
1 vote
2 answers
355 views

How to make the code resource URL private for SFMC use only [closed]

I need to restrict the access of code resource endpoints to SFMC use only. Some update codes are added in SSJS which will be called from SFMC. In case the URL is exposed somehow, I don't want to have ...
krish's user avatar
  • 125
0 votes
0 answers
75 views

How to update DE containing millions of records without primary key field

I tried updating large batch of records(millions of records), but i couldn't.What would be the mistake in this code? var props = [ { "Name": "JOBID", ...
SFMC's user avatar
  • 21
0 votes
0 answers
49 views

Split JSON in N strings [duplicate]

I am trying to separate a json into several pieces n times depending on the size of the json and the limit of characters within a field, for example, if the json occupies 16000 characters I divide it ...
MRT's user avatar
  • 9
0 votes
1 answer
287 views

Split JSON to insert in a Data Extension [duplicate]

I am having a problem working with ssjs in marketing cloud. I have an array with a json that corresponds to the information about the data of data extension fields, and this information in json I need ...
MRT's user avatar
  • 9
1 vote
0 answers
190 views

Fetch form values from localStorage to SSJS script

I am trying to resolve an issue of a scenario in which two cloud pages are created, for example, Page A contains a form with multiple fields, while Page B contains SSJS code to send the data to the ...
Harshit Singh's user avatar
0 votes
1 answer
3k views

HTTP response content showing null value when using Script.Util.HttpRequest

I'm trying to create an SSJS script that can store the values in the marketing cloud's database using the Script.Util.HttpRequest method. When I try to print the HTTP response content, I get a null ...
Harshit Singh's user avatar
1 vote
1 answer
851 views

Unable to retrieve security descriptor for this frame error in SSJS

I'm trying to get my head around SSJS to create a script that can store the provided values in the SFMC database using Script.Util.HttpRequest function. I am able to see that the values provided were ...
Harshit Singh's user avatar
0 votes
1 answer
128 views

Marketing Cloud - Unable to store the data into DE

I have created a survey page, question and answers(radio button) are retriving from data extension and displaying on a cloud page. On submitting the answers, values are not storing in data extension. ...
Sravani Koneru's user avatar
1 vote
0 answers
93 views

SSJS: Unable to retrieve security descriptor for this frame error

I'm trying to create a script to store values from a form on a cloud page in the SFMC database using the SSJS HTTP Post method, but I'm receiving the following error: Exception occurred: Unable to ...
Harshit Singh's user avatar
0 votes
1 answer
422 views

How to retrieve all the Data Extension having similar name?

I want to retrieve all the DataExtension having similar kind of name. For example if I have 4 DE having name Mannya_grocery_de Manav_goods_de Manjeet_de Amarjeet_de So Now If I am passing "man&...
Mannya's user avatar
  • 1
0 votes
1 answer
552 views

How to capture email click activity into custom data extension in Journey builder

I am sending emails to users using journey builder. These emails have yes or no buttons. I want to send email based on these buttons. That means when click yes send abc email & when click no send ...
Sfdcprgmr's user avatar
  • 405
1 vote
1 answer
121 views

ERROR "Unable to retrieve security descriptor for this frame." When using WSPROXY's createitem with JSON object any tips?

So, I've been testing some use cases with SSJS and got into this error "Unable to retrieve security descriptor for this frame." which occurs with the apiAudiencia.createItem("...
Wilson Moreira's user avatar
0 votes
0 answers
134 views

Set ClientId in MC without using WSProxy?

I'm trying to impersonate ID of a subaccount without using WSProxy library but I can't find a way to do it. In WSProxy we can do like this: var prox = new Script.Util.WSProxy(); prox.setClientId({&...
Duc Le's user avatar
  • 2,603
0 votes
0 answers
282 views

Update Subscriber Status on Click button

I have an unsubpage that is displayed when someone clicks unsub in the email. I want to resub on click with a button on the page - the below code is not working - can anyone inform me why? I have some ...
GS65's user avatar
  • 127
0 votes
0 answers
190 views

Fetching subscribers with ssjs and ampscript from SalesCloud

I'm trying to fetch the data from SalesCloud. The codes currently are hosted in CloudPages, and I'm using the SFMC test sent from the email in Content Builder to pass the subscriber details to the ...
Mario Manuel Andrianto's user avatar
0 votes
2 answers
532 views

Send a datetime value to Salesforce object through SSJS

I have a SSJS script that updates a field on the campaign member object. I now need to update one more field, which is a datetime field. Thing is, I don't know how to correctly parse the date I have ...
robruf's user avatar
  • 362
0 votes
1 answer
459 views

SSJS script activity to update Salesforce Object not working

I'm trying to update a custom field on the Campaign Member object through SSJS by taking it's value from a Data extension. Here's the SSJS script: <script runat="server"> Platform.Load(...
robruf's user avatar
  • 362
0 votes
1 answer
377 views

Loop SSJS script to retrieve Data from DE and update _MobileAddress for Mobile number Change

As I'm just getting started with SSJS scripting I need help for the below scenario. I have a DE which consist of Contact_ID & Mobile_Number fields. I need to update _MobileAddress table for mobile ...
Ramya's user avatar
  • 31
0 votes
1 answer
348 views

Get a list of filtered data extensions in Marketing Cloud

I have some code in SSJS that retrieves all the Data Extensions (with most of its metadata) in a BU. var prox = new Script.Util.WSProxy(); prox.retrieve("DataExtension", cols, filter) ...
Lee Henkel's user avatar
1 vote
3 answers
727 views

Access shared data extension from child BU using SSJS

I am trying to access the value from a Data extension, using the below code. The code works fine if I pass the external key of the regular data extension. But when I pass the value of the shared data ...
qaz's user avatar
  • 11
0 votes
1 answer
206 views

Add multiples row in data extension when single column has multiple values

I tried to achieve the following task but the query output was showing only the first values Query SELECT SUBSTRING([Location], 1, CASE CHARINDEX('OR', [OFFER_CODE]) WHEN 0 THEN ...
Anglica's user avatar
0 votes
1 answer
503 views

How to delete a data extension (entire DE not only records) using SSJS? [closed]

I was trying to delete a data extension inside automation but couldn't find way to delete it using SSJS. This is data on how to delete records in a data extension, but not the data extension itself: ...
Mohammad Makki's user avatar
0 votes
1 answer
563 views

How to configure a cloud page to be inaccessible to public in SFMC

Currently, I have built a cloud page in SFMC that is being used for custom report. Goal is to make it private / inaccessible to public so only SFMC users can access it. Out of scope options: Private ...
kl2's user avatar
  • 317
2 votes
2 answers
489 views

SSJS WSProxy code is unable to access SFMC object - AutomationActivityInstance

I am trying to work on SSJS script to fetch the details about the automation activities. I found an object called AutomationActivityInstance - https://developer.salesforce.com/docs/marketing/...
user12971's user avatar
0 votes
1 answer
70 views

retrieve code snippet data via wsproxy

I am trying to retrieve the name and customer key from many content blocks like I do with data estensions var prox1 = new Script.Util.WSProxy(); var cols1 = ["Name","CustomerKey"]; ...
user117440's user avatar
0 votes
1 answer
654 views

SSJS code to fetch automation details issue

I am using the below SSJS WSproxy code to extract the automation details like name, status,start time etc. to create a dashboard <script runat="server"> Platform.Load("Core",...
deks's user avatar
  • 3
0 votes
1 answer
508 views

How to know if an User has logged in SFMC using SFMC APIs or SSJS scripts

We are creating a cloud page where only the users who have access to SFMC can access and login to the page. If the user is currently not logged into SFMC then, when the user opens the Cloudpage it ...
Sayan Prachanda's user avatar
0 votes
1 answer
1k views

How to access user role and permission information?

We need to provide access to the following: A list of all users, their status roles, permissions, and basic info (user name, email, business unit, etc.) A list of all permissions A list of all roles ...
yoni349's user avatar
  • 81
0 votes
1 answer
397 views

Performing a record retrieval via WSProxy in SSJS

In my data extension, I have two fields / columns: JobID DE_NAME In this use case i want to receive the value for JobID and DE_NAME (1st row only) var queryAllAccounts = true; var cols = [&...
kl2's user avatar
  • 317
0 votes
1 answer
1k views

How to retrieve a record from a data extension field in SFMC using SSJS

In my SSJS, I am using this approach to retrieve the value / record from a data extension field. Data extension name is Test_QResult Data extension field name from where i want to retrieve value is ...
kl2's user avatar
  • 317
0 votes
1 answer
310 views

How to target a retrieved data extension in a FOR LOOP while using WSProxy

Currently, I am using the following approach to define my Data Extension Platform.Load("core","1"); // instantiate the WSProxy object to make API calls var api = ...
kl2's user avatar
  • 317
0 votes
1 answer
443 views

SSJS variable not being passed to JSON payload

I am trying to do an API call. I am getting a query string parameter from a URL and attempting to pass it into a JSON payload for an API call. However, it looks like the value in the variable is not ...
hfjl's user avatar
  • 13
0 votes
1 answer
515 views

how to use SSJS to extract all distinct values (may require looping) and push it to sql query in marketing cloud?

I am new to SSJS and have not used it yet. I have a use case where I need to extract JobID and Data Extention Name from SendLog Data Extension. I use JobID and DE_Name in SQL query but right now I ...
kl2's user avatar
  • 317
-1 votes
1 answer
161 views

Can we use RedirectTo() functions to call the contentblock in marketing cloud

We have a requirement - when we click on a button, it should redirect to particular contentblock. I have tried multiple ways like <a href="%%=ContentBlockByKey(@contentBlockKey)=%%">...
Ranjan's user avatar
  • 67
0 votes
1 answer
88 views

Cannot Retrieve Data Extensions' folder Name when running script for the entire enterprise

For a set of specific Business units, I am trying to retrieve Data extensions older than 92 days (using ModifiedDate) and load them into another DE. And, I would like to retrieve these fields: DE ...
Araarso's user avatar
  • 23
3 votes
1 answer
808 views

Comparing timestamps in SSJS

As the access token is valid for 20 mins in SFMC, I want to reuse the access token. Hence I tried to write the below code. What I am doing currently I have created a Data Extension called - tokens_DE ...
natlin's user avatar
  • 33
4 votes
1 answer
235 views

SSJS RemoveCookie and SetCookie

I can't find a lot of info on cookies, so trying my luck here. A couple things: I can't seem to get this to work Platform.Response.RemoveCookie("mycookie"); I've removed everything on the ...
Stan Alachniewicz's user avatar

1 2
3
4 5
19