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.
1,008
questions
1
vote
2
answers
55
views
Update field to Null with SSJS
I'm trying to update a field in a data extension to NULL for everyone in the DE. I am new to SSJS and tried to use a script from somewhere else but am struggling to make it work. Can anyone help ...
-1
votes
1
answer
27
views
Can you create a Journey using Salesforce Data entry ussing SSJS in salesforce marketing cloud?
I was wondering if it was possible to use a SSJS script to build a Journey with a salesforce data entry, mapping the columns and any entry criteria all on the SSJS script?
if possible i will run the ...
-1
votes
0
answers
22
views
Is it possible to edit my .txt file with a SSJS before exporting to FTP?
I have a DE in SFMC that has 3 columns: month, id and cg and let's say it looks something like this:
Month | id | cg
202401 |11tg3 | n
I later export it to the FTP server using a Data Extract ...
0
votes
1
answer
67
views
Parsing JSON IN Data Extension - SSJS
I'm trying to parse JSON data stored in a field (Product2) within a Salesforce Marketing Cloud Data Extension and then upsert the parsed data into another Data Extension. I've written a Server-Side ...
0
votes
1
answer
47
views
Using SSJS to change block in an email
I have folder containing multiple emails that share a common block. Is there any way I could build a SSJS script inside automation studio that would automatically change this specific block from all ...
0
votes
1
answer
37
views
Update data in All Subscriber table with data in DE using SSJS
I'm attempting to update the Email Address of a specific subscriber using SSJS.
The SSJS is retrieving the Subscriber Key and New Value (updated email address) in a Data Extension. If the Subscriber ...
0
votes
1
answer
58
views
Calculate Duration
I am attempting use the script activity to log data about an automation and its duration. I have two scripts one to run at the beginning of the automation and one at the end. This initial one is ...
0
votes
1
answer
89
views
Handling Microsoft SafeLinks Double Activation in Email Links with AMPscript
I'm currently facing a challenge with Microsoft SafeLinks in an email marketing context. SafeLinks, a feature in Microsoft's security suite, pre-fetches URLs for security checks and then again when a ...
0
votes
0
answers
22
views
SSJS GET Image request retrieving different data than Postman
Using a SSJS GET on an endpoint which returns binary image data results in different data than the same call in Postman. Here's my setup:
var url = "https://graph.microsoft.com/v1.0/me/photo/$...
0
votes
0
answers
58
views
Unable to retrieve security descriptor for this frame
My code in decrpypting the data that needs to be decrypted. After that it's not going in For loop but directly goes to Catch statement and throws error. Wondering if this something with my permissions ...
0
votes
2
answers
70
views
Data extension retrieval is not working - ssjs
A simple code to retrieve data extension details is not working. It's giving undefined values.
Here's the code :
<script runat="server">
Platform.Load("Core", "1.1....
0
votes
1
answer
43
views
Creating Data extension field through SSJS (through API calling)
I'm now testing a new method to create a data extension field automatically through REST API calling,referring to this developer DOC
It's operated by POST method, and I think I wrote all of the ...
0
votes
1
answer
50
views
Unable to perform PUT request using WSProxy
I am trying to do a PUT request. I am able to generate a token (using POST method) and am able to run this in POSTMAN and do a cURL command in the command line. I can't do it in SFMC though. I have ...
1
vote
1
answer
41
views
Account.Retrieve SSJS core function has stopped working
I'm having issues with the Account.Retrieve() SSJS core function. I was previously able to use this code to retrieve all Business Units in an Enterprise account:
<script runat=server>
Platform....
0
votes
0
answers
68
views
SSJS QueueMO - The remote server returned an error: (400) Bad Request
I've been trying to get a POST call to the sms/v1/queueMO endpoint (https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_sms/postQueueMO.html) to work from a Cloudpage ...
0
votes
0
answers
45
views
An error occurred: Unable to retrieve security descriptor for this frame
I am trying to post an image in third party tool using below code, but getting an error" An error occurred: Unable to retrieve security descriptor for this frame."
Can any one please help me,...
1
vote
1
answer
35
views
HTTP DELETE for a Push Location
I'm trying to delete a Location through rest api with the api documented here.
The script I'm using is:
*code to get the authentication*
var IdLocationsDelete = ["ID1", "ID2"]
var ...
0
votes
1
answer
33
views
Possible to export a Data Extension programmatically through SSJS
I'm looking for a way to export a Data Extension using SSJS.
I know it's possible to create a script activity using SSJS and then executing that. Is it possible to do the same with an export activity? ...
0
votes
1
answer
24
views
HTTP GET for All Push Locations not working
I am creating a script to get the list of all locations but the Get function is not retrieving anything. Here's my script:
<script runat="server">
Platform.Load("Core", "...
0
votes
1
answer
25
views
Why is the SSJS constructed query not updating?
I'm trying to construct a query using SSJS and update the quarry activity.
Using Core SSJS: When I'm using the variable containing the new query string, I get a smile error with now details:
Error
...
0
votes
1
answer
28
views
Correct syntax to reference dynamic column name with SSJS Rows.Update() function
When the column name of a Data Extension is unknown and data needs to be written to that column what is the correct syntax as the following do not seem to work,
Where e.num is some dynamic value like ...
0
votes
1
answer
69
views
I want to update Salesforce Automotive Cloud Object and Marketing Cloud Data Extension using SSJS in Automation Studio
I have a data extension named "SMSUnsubLog" which includes SMS unsub data of customers.
I want to get data from the data extension and update salesforce object(ContactPointTypeConsent) and ...
0
votes
1
answer
83
views
How to get status of query definition
I want to get the status of a query definition. I am interested in knowing if it ended up in an error or not.
I run query definitions from a script, but I cannot access the information about whether ...
0
votes
0
answers
37
views
Data Extract to Add All Unsubscribed Contact to Auto-Suppression List Failing
We've changed our source data for MC which has updated everyone's Subscriber Key. In order to honour unsubscribes, we want to move all our old unsubscribed subscribers to an auto-suppression list.
I'...
0
votes
0
answers
41
views
Script.Util.HttpRequest automatically retrieving content of redirect page
We have a process where the unsubscription of a certain product are handled via a csv which is dropped in the FTP, then imported in a data extension and finally processed by a script.
In this script ...
1
vote
1
answer
61
views
(SSJS Cloudpage Error while batching records) Fetching Records: Unable to retrieve security descriptor for this frame
I have a cloudpage which serves the purpose of ejecting records from existing journey(s). The credentials are stored in a BU Package DE, so are the records in an ejection DE. Since the exit contact ...
-1
votes
1
answer
104
views
How do I create a Cloud page with dynamic filtering
I'm in the process of building a Cloudpage app for lead handling.
The source DE is about 100k rows.
The users need to be able to use multiple filters simultaneously to narrow down the results.
Is ...
0
votes
1
answer
66
views
Need help with optimizing JSON-content feed loading inside of a Newsletter template
I have a question about optimizing Salesforce Marketing Cloud Newsletters with JSON-based feed content for production sends.
The vast majority of our newsletters sent via Marketing Cloud are comprised ...
0
votes
1
answer
64
views
DataExtension.Init not working
I have tried to use DataExtension.Init() several times with no avail. I can see the Data extension in both parent and child business Unit (it lives in the shared data extension folder). I've also ...
0
votes
1
answer
50
views
How to Exclude and Select Multiple Data Extensions in SOAP API Email Sends?
We are currently working on creating a user-initiated email send using the SOAP API. Our payload is functioning as expected, but we need assistance with the following:
How can we add a data extension ...
0
votes
1
answer
44
views
Is it possible to Retrieve the code from SSJS Script activity from Automation using API?
I am planning to display the Activities from Automation Build, I already found the SOAP object for query activities, but I cannot find an soap object or a rest endpoint for this SSJS retrieving code.
0
votes
0
answers
62
views
Retrieve template based emails and their associated templates using the Content Builder API
I'm trying to retrieve emails and their associated templates using the Content Builder API. In Postman, I can find the template name field, but I can't access it using SSJS. Does anyone know how this ...
0
votes
1
answer
25
views
How to change/update DataExtensionField's length using ssjs?
i currently have data extension, its customerKEY, data extensionField's objectID, and a soap api call which can implement this (updation/change of data extension field's length)
soapApi code:
<?xml ...
0
votes
1
answer
69
views
Redirect not working in if/else but working in some part of the code
In This code Line 62 & 65 where i have commented out { Redirect(concat(@loginPageURL,"?invalidtoken=",1,"&referer=",@referer)) }
The code does not work when i include these ...
1
vote
1
answer
68
views
How to log details of SSJS 400 error
I'm writing a script that will delete contacts found in a data extension from the parent and child BU and then delete the record in that DE. After repeatedly getting a 400 error without understanding ...
0
votes
0
answers
46
views
SSJS SFMC -> OPEN AI ASSISTANT GET REQUEST PROBLEM
I'm trying to make an API call to OpenAI, specifically to its assistant. I've already created the assistant and have the ID and updated API key.
I have an example code in SSJS that works well. I'm ...
0
votes
1
answer
49
views
Data Extension Inventory script - not loading into the DE
I have this SSJS/WSProxy script that should extract all DEs over 2 years old from create date & load the DE info into "DE_Inventory_list" DE. No errors but would not load the list of DEs ...
0
votes
0
answers
47
views
Lookup Customer Journey DE entry rowCount by using a field of a Data Extension
Hello everyone and thank in advance for helpfulness!
Let me preface this by saying that I am working on Marketing Cloud and, specifically, I am in the process of building a Data extension of reporting ...
0
votes
1
answer
90
views
SFMC POST Request
I am writing a script to retrieve data from one of our Data Extensions, and send it to an external API. Here is my script for this:
<script runat="server">
Platform.Load("core&...
1
vote
2
answers
88
views
Use ampscript to check data extension has an EmailAddress field
I've got a custom process which allows users to match manually uploaded data to SF ContactID values. It relies on the EmailAddress field being called EmailAddress and having the correct field type to ...
1
vote
1
answer
195
views
Marketing Cloud - SSJS Activity timing out. Not sure of error
I have an SSJS Activity I am trying to get to work wherein we are calling an API endpoint using basic authentication (obviously the user and pass are obscured in production). But I am having issues ...
0
votes
1
answer
65
views
Create a new data extension using SSJS from a file drop
I am attempting to create a new DE in SFMC from a csv file drop using SSJS. There's many resources that references the ability to do this using SSJS, but I am looking for assitance on why it's not ...
2
votes
1
answer
117
views
SSJS functions - Platform.Function.GUID() and Platform.Function.UpsertData - no records in Data Extension
Trying to use ssjs 2 functions - Platform.Function.GUID() and Platform.Function.UpsertData in the Script Activity
Added Script Activity into the Automation and executed Run Once. No errors, however no ...
0
votes
1
answer
85
views
SFMC - Lookup a DE and copy the results into another DE
I am new to SSJS, I am trying some basic use cases, in this case my use case is to lookup a DE and copy the results in target DE, both DEs are having same data structure. Below is given my code, its ...
0
votes
1
answer
73
views
Pagination a script
I need to activate contacts in unsubscribed status in all subscriber in SFMC. This script works but i need to manage 100k rows. There are any way to paginate the script?
<script runat="server&...
0
votes
1
answer
66
views
SFMC - how to load DE with assets' tags via REST API & SSJS?
I am successfully using the /asset/v1/content/assets REST API to populate a data extension with information about all the images in my business unit, via an SSJS script in Automation Studio. However, ...
0
votes
1
answer
73
views
Upload resulting gif of AMPscript BarcodeURL() to content builder
I want to send a member card as barcode via SFMC/Whatsapp. However, Whatsapp content does not allow the use of the BarcodeURL() function to generate the barcode image. My plan now is to use a code ...
0
votes
1
answer
116
views
How to update subscriber status of a subscriber in all subscribers present in a child BU using landing page present in other child BU?
I have created a SOAP envelope to invoke all subscribers present in a child Business Unit (BU) from another child BU using a landing page. By utilizing WS Proxy in my landing page located in CHILD BU ...
0
votes
1
answer
132
views
How to Contact delete (All contacts) in Child BU
Is there a way to do contact delete in Child BU? (All contacts)
I want to delete the Contact in bulk.
All marketing activities (Journey, e-mail sending, etc.) take place in Child BU.
I would like to ...
1
vote
2
answers
217
views
Transfer XML API response as file to FTP with SSJS
Context: I am looking to implement a daily automated import of a product catalog. I can only access the catalog via an API endpoint that cannot be filtered/paginated and gives ±100K rows of XML as ...