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
15 votes
0 answers
2k 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....
Bechir's user avatar
  • 526
10 votes
1 answer
2k views

Using AMPscript/SSJS how do you unsubscribe a subscriber from a child business unit?

My goal is to create a page that passes a business unit id and a subscriber key. The page sits on the parent/enterprise business unit, it will receive business unit ids from a child business unit. ...
Rick Locke's user avatar
9 votes
1 answer
2k views

Handing REST API POST Exceptions using SSJS Try-Catch on a Landing Page Form Submission with AMPSCRIPT

I have an issue with a landing page containing a webform that submits input from the user and using AMPSCRIPT I make a Rest API call using the HTTPPost2 function to utilize the validateEmail resource. ...
NewJackSwing4Ever's user avatar
8 votes
2 answers
3k views

Is there a way to identify all the places a Content Block is used?

I'm trying to identify all the places a Content Block is used. The goal is to be able to reference what will be affected if a Content Block is modified. I've looked a the Asset in the REST API, but I ...
victorcorey's user avatar
  • 1,808
8 votes
1 answer
1k views

Using SSJS can you set a response status code?

In cloudpages, I've been trying to build a handler page for an ajax form POST that checks a certain DE to prevent duplicate submissions. It needs to return "duplicate entry, not saved" or "...
ModT's user avatar
  • 136
7 votes
2 answers
13k views

REST API Methods in AMPScript or SSJS

Is there any way via AMPScript or SSJS to utilize HTTP methods outside of GET and POST? I have had no problem utilizing these two via the HTTPPost() and HTTPGet() functions, but have not found any ...
Gortonington's user avatar
  • 30.6k
6 votes
2 answers
2k views

Are there any external call out limits in Marketing Cloud?

I would like to run an SSJS script which makes callouts to a third party system (which sends WhatsApp messages). As this action will happen frequently I would like to know if there are any limits I ...
Deployment Failure's user avatar
6 votes
1 answer
713 views

Caching HTTP Get calls in SFMC for emails

I've got a email which does a HTTP Get call using SSJS Platform.Function.HTTPGet, results return JSON and I can parse it successfully. Would the calls get cached or would a Get call happen per ...
Noor Alam's user avatar
  • 755
6 votes
3 answers
627 views

Child Automation run as step in Parent Automation?

Any ideas on using this SSJS Automation Trigger (or some other method) to Trigger a Child Automation as a middle step in a Parent Automation that once complete continues to process? I have a long (...
MIL's user avatar
  • 128
6 votes
0 answers
747 views

Using a Shared SSJS functions in my Automation Script Activity

Let me preface this by saying that I am not looking at cloud pages. I am looking to either use Content Blocks or other Activity Scripts to store JS functions which I can load into an Automation Script ...
JordanGS's user avatar
  • 198
6 votes
1 answer
1k 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 ...
Lorenzo's user avatar
  • 61
5 votes
2 answers
5k views

Difference between AMPscript and SSJS

What is the main difference between AMPscript and SSJS in Marketing Cloud? Can you please give me clear information about the differences between AMPscript and SSJS?
UserSFMC's user avatar
  • 157
5 votes
1 answer
10k views

Making a REST API call from a Script Activity in Automation Studio

We are trying to update a service cloud custom object from marketing cloud. Can we make a REST api call within a script in Automation Studio.It will be great if someone in this forum can confirm they ...
Monomit Bhowmik's user avatar
5 votes
1 answer
3k views

Identify the Type of an Automation Activity using SSJS WSProxy

I'm trying to create an API call that will return the SQL Code from all Query Activities within an given Automation. Using the information provided in this question Retrieve multiple tasks in an ...
Cameron Robert's user avatar
5 votes
2 answers
848 views

Deleting a Mobile Connect instance of a contact only (without deleting the entire contact)

The current deletion framework that was added last year does deletes entire contacts. A contact deleted this way is deleted from: All Contacts All Subscribers Mobile Connect I have a problem where ...
Rafał Wolsztyniak's user avatar
5 votes
1 answer
2k views

What's the different between the core versions in SSJS?

I wrote a number of SSJS before, but a question that just can't sort it out: the core version. From the official document: it said: Given that the Core library has 1, 1.1, 1.2 and 2.0 versions, ...
PY Yick's user avatar
  • 201
5 votes
1 answer
702 views

Error adding EmailSendDefinition using SSJS

Using the documentation in the SF Help docs I am trying to create send an email to a specific person using the following code: <script type="text/javascript" runat="server"> try { ...
Deployment Failure's user avatar
5 votes
1 answer
1k 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 ...
Rick Locke's user avatar
5 votes
0 answers
256 views

Adding Fields in a Data Extension leads to resetting retention policy

I am trying to add a 'CREATED_DATE' field with a default value of current date, in my existing Data extension using wsproxy. The code runs fine and the fields gets added, however the data extension ...
Swati Mishra's user avatar
  • 1,658
5 votes
0 answers
450 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 ...
Ivan Razine's user avatar
5 votes
0 answers
342 views

Get FilterPart of FilterDefinition in SSJS (ExactTarget)

I'm trying to fetch the FilterParts of FilterDefinitions in SSJS (for debugging now used on a landing page). var results = FilterDefinition.Retrieve({Property:"CategoryID",SimpleOperator:"equals",...
Jhu884's user avatar
  • 153
5 votes
1 answer
2k 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 ...
Jack85's user avatar
  • 489
4 votes
3 answers
10k views

Using AMPscript with SSJS Activities

I have tried using the below AMPscript block in an SSJS Activity, however it appears that Script activities only support SSJS and AMPscript cannot be included in Script Activities — please can someone ...
Eliot Harper's user avatar
  • 16.5k
4 votes
2 answers
3k views

Accessing SSJS variables and functions from a Content Block

I'm trying to figure out a way to inject SSJS code in a CloudPage instead of having to copy and paste each time. That is, I have a library of functions that I want to manage centrally and include in ...
Eliot Harper's user avatar
  • 16.5k
4 votes
2 answers
13k views

Retrieving and Displaying the records from a data Extension using SSJS or WSProxy

I am new to SSJS/WSProxy. Any idea, how you can see the retrieved records from data Extension and put them in an Array. Question 1: Also What are the different methods to see the results in SSJS or ...
tanvi's user avatar
  • 51
4 votes
1 answer
1k views

Update Data Extension Field to NULL using WSProxy

I'm trying out the new WSProxy API for server-side javascript. I haven't been able to update a Data Extension field to NULL when it already contains a value. Let's say "Student" is a nullable field. ...
Billk's user avatar
  • 41
4 votes
1 answer
2k views

Delete Subscriber records in Salesforce Marketing Cloud

We want to delete all subscriber records from "All Subscribers" which are not "Unsubscribed" or "Bounced" and created before last six months. How can we do it using automation studio?
SFMC User's user avatar
4 votes
1 answer
6k views

SFMC SSJS error handling - try catch

I have the following code: <script runat="server"> Platform.Load("Core","1.1.1"); try{ var logDE = DataExtension.Init("testDE"); throw "this is an error"; logDE.Rows.Add({"c1":"...
Sascha's user avatar
  • 41
4 votes
1 answer
699 views

SFMC Query 3rd party API through SSJS not on port 80 or 443

Trying to query a 3rd party API through a post request from a SSJS script. However, I get the following error: System.Net.Sockets.SocketException: A connection attempt failed because the connected ...
mercifulhop's user avatar
4 votes
1 answer
3k views

Using SSJS to send single email in Marketing Cloud

Is it possible to send a single email to a Subscriber rather than a whole List using the SSJS Send Mail function? My code is as follows, you can see we have to provide a List ID to send to. <...
Deployment Failure's user avatar
4 votes
1 answer
780 views

SJSS function to get raw body data

I am using a shopify API webhook to post JSON data on an event to a cloud page URL which currently is using a static set json to upsert to a DE but will need to get the raw JSON that is sent from the ...
Chris Haddad's user avatar
4 votes
1 answer
1k views

How to translate the cloud pages based on the browser language in salesforce marketing cloud

I have been working in custom preference centre and one of the requirement is to translate the page based on the browser language. The difficulty here is detecting the browser language "Navigator....
Manoj Chandran's user avatar
4 votes
3 answers
2k views

Looping through json in email - impossible?

This nested Guide Template Language snippet brings me 6 rows of titles. Problem: I have a complex layout in an email and I want to populate it with titles in different places. I can not make a ...
Tove Walden's user avatar
4 votes
1 answer
4k views

Can you retrieve more than 2500 records with SSJS?

I am trying to use a script activity to update a data extension with the statuses of subscriber records. I have managed to get the code working but it will only add 2500 records. I have been reading ...
wimpywombat's user avatar
4 votes
3 answers
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 ...
k s's user avatar
  • 141
4 votes
1 answer
312 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
4 votes
1 answer
135 views

Limit code execution for BCC send

Due to compliance reasons, I'm required to BCC an archive email address for each SFMC send. I have below code snippet in one of the emails. SET @caseCreate = CreateSalesforceObject( 'CaseComment', ...
Mateusz Bartkowiak's user avatar
4 votes
1 answer
485 views

Can my Custom Block output SSJS in into a block in Content Builder?

I'm creating a custom content block by extending content builder as described here: https://developer.salesforce.com/docs/atlas.en-us.mc-app-development.meta/mc-app-development/content-sdk.htm I'm ...
Steven Low's user avatar
4 votes
1 answer
308 views

automation/v1/filetransfers - patch endpoint not working

For a specific usecase, I need to do dynamic csv exports from SFMC to an external serveur (s3). the dataextract works well. I can browse a list of DE, modify 1 temporary dataextract activity (by ...
joe_le_rap's user avatar
4 votes
1 answer
623 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 ...
Adam Ridgway's user avatar
4 votes
0 answers
3k 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"...
James Angus's user avatar
4 votes
0 answers
606 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 [""],...
Joseph's user avatar
  • 81
3 votes
2 answers
5k views

AMPscript / SSJS learning resources

I'm fairly new to using AMPscript and SSJS and am looking to use both in future email campaigns. However, I'm having a very hard time finding any learning resources outside of the SFMC documentation. ...
TomC's user avatar
  • 35
3 votes
2 answers
5k views

Is it possible to retrieve the client IP address on a landing page?

I'm open to using SSJS or AMPscript to find the IP address of the client who is accessing a landing page. I tried this AMPscript: %%=HTTPRequestHeader("X-Forwarded-For")=%% Which resulted in a blank ...
Daniel's user avatar
  • 1,277
3 votes
3 answers
5k views

Retrieve Data Extension rows using WSProxy

I just learned how to use WSProxy as an alternative to use in Salesforce Marketing cloud. The SF documentation provides retrieve data but is only limited in retrieving data extension schema and ...
Obet's user avatar
  • 78
3 votes
1 answer
5k views

ParseJSON using SSJS

I am unable to extract msg from the JSON response. @returnCode works fine and I am passing it to SSJS, but then I cannot get the msg value. <script runat="server" language="javascript"> ...
zuzannamj's user avatar
  • 14.4k
3 votes
1 answer
2k views

Ampscript or SSJS method to copy data extension

Is there a way to copy a data extension, either using ampscript or SSJS, to create a new data extension? Some of our work involves duplicating several data extensions with similar schema and it would ...
TCassa's user avatar
  • 878
3 votes
1 answer
1k 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 ...
Nate Harris's user avatar
3 votes
1 answer
395 views

Using SSJS in Automation Studio to unsubscribe contacts from All Subscribers [duplicate]

We are using a custom preference center and an automation that extracts contacts from our Master Permission DE, who have Opt-in set as 'false'. This DE that contains opt-outs is evaluated and later ...
nix9247's user avatar
  • 538
3 votes
1 answer
5k views

SSJS to call Content Block with AMPscript

Use case: Through automation studio, a script activity is use to call and reference a content area through the "ContentAreaByName" function. That content area contains AMPscript that performs specific ...
AnonWonderer's user avatar
  • 2,131

1
2 3 4 5
20