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
11
votes
0answers
358 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....
9
votes
1answer
864 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. ...
9
votes
1answer
873 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. ...
7
votes
2answers
601 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 ...
7
votes
1answer
444 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 "...
6
votes
1answer
272 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 ...
6
votes
3answers
219 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 (...
5
votes
2answers
491 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 ...
5
votes
1answer
544 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, ...
5
votes
1answer
392 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 { ...
5
votes
1answer
379 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 ...
5
votes
1answer
1k 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 ...
4
votes
3answers
6k 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 ...
4
votes
2answers
3k views

Difference between Amp script or ssjs

what is the main difference between amp script or ssjs in marketing cloud. Can you please give me clear information for amp script or ssjs difference.
4
votes
2answers
7k 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 ...
4
votes
1answer
5k 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 ...
4
votes
1answer
620 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 ...
4
votes
1answer
1k 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. <...
4
votes
1answer
525 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 ...
4
votes
2answers
288 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 ...
4
votes
1answer
259 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 ...
4
votes
1answer
354 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....
4
votes
1answer
3k 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 ...
4
votes
1answer
306 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 ...
4
votes
2answers
1k 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 ...
4
votes
1answer
254 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 ...
4
votes
3answers
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 ...
3
votes
2answers
4k 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. ...
3
votes
1answer
985 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"> ...
3
votes
1answer
121 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 ...
3
votes
1answer
1k 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 ...
3
votes
1answer
91 views

How Can I Programmatically Update Multiple non-sendable DEs to be Sendable?

I have a cleanup I'm working on and hitting a wall. We use email address as the subscriber key. I have a few hundred DEs with an "email" column that are NOT marked as sendable. I want to update them ...
3
votes
1answer
1k views

Scripting language in ExactTarget

Disclaimer - Newbie to ExactTarget and AMPScript Aside from Javascript and AMPScript, what languages (if any) are accepted as scripting languages in ExactTarget? We have a Content Area full of a ...
3
votes
1answer
87 views

Check IBAN validity function in SSJS

I found a piece of client side Javascript code to check the validity of an IBAN bank account number here: https://stackoverflow.com/questions/21928083/iban-validation-check Now I'd like to use this ...
3
votes
1answer
906 views

How to reference client-side input from a cloud page in SSJS

I have two microsite cloud pages: (1) to ask a user for the information, and (2) one that takes the information and uses it in a SSJS WSProxy call The first page captures information like: <form ...
3
votes
1answer
482 views

Is it possible to perform HMAC SHA1 encoding with Ampscript?

Is it possible to do this with Ampscript? Is it possible to achieve this with SSJS? I understand there is an apex function that can do this, but I am not sure it is possible to use apex with ...
3
votes
1answer
438 views

Rows.Remove() using simple operator

This code returns an generic error - is it not possible to use simple operators to remove rows from a data extension? <script type="text/javaScript" runat="server"> Platform.Load("core", "...
3
votes
1answer
1k views

How to set a cookie using SSJS?

This question relates to: Is it possible to add http headers. for example set-cookie, via ampscript or ssjs in ExactTarget? The answer on that question does not specifically call out how to set a ...
3
votes
1answer
2k views

Can we generate PDF in ExactTarget?

I want to generate PDF document on the basis of data available in my customer DataExtension and print it in proper format so that it can be sent to customer by a email. is there any AmpScript, SSJS, ...
3
votes
2answers
1k views

Setting a function to run at set intervals in a Landing Page in SSJS

I would like to run the following HTTP.GET function at a set interval (every 1 minute) until 10 minutes have passed or it has succeeded in retrieving the content. var contentRetriever = function(){ ...
3
votes
1answer
2k 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":"...
3
votes
1answer
487 views

Creation of a Filter Activity via API

After digging, I have found the API object for FilterActivities, and have been able to Perform, Retrieve, etc. from them, but have been unable to Create one from scratch. I have received the ...
3
votes
1answer
2k views

Is it possible to call external SOAP/REST API in ExactTarget?

Is it possible to call external SOAP/REST API in ExactTarget? I want to call external SOAP/REST API in landing page and need to use SSJS. I tried to search in ExactTarget wiki but didn't get any ...
3
votes
1answer
4k views

Has anyone been able to create an automation through SSJS yet?

I've created a server-side JavaScript activity to create an automation, which is throwing an error: An error has occurred: {"message":"An error occurred when attempting to evaluate a CreateObject ...
3
votes
2answers
1k views

After I Stringify a DE using DataExtension.Init how can I output or filter the data in JS?

I am wondering how can I filter data using JavaScript? For example, I would like to output data in JS. Platform.Load("Core","1"); var layouts = DataExtension.Init("DATA_EXTENSION_NAME").Rows....
3
votes
1answer
3k views

Output a SSJS variable with Ampscript for loop

I have a for loop in SSJS and I am trying to output it outside this scope using AMPSCRIPT. I know there is a way to output the value of a SSJS variable into AMPSCRIPT. My question is, how can output ...
3
votes
1answer
302 views

WSProxy to Retriever All QueryDefinitions in Marketing Cloud

I'd like to retrieve ALL the queries in my current BU and return the results in a DE call "Queries". I've been reviewing a number of examples and pages on SS but haven't come across a simple Retrieve ...
3
votes
2answers
1k views

How to resubscribe a user in Marketing cloud using SSJS?

I have unsubscribed users using logunusbevent call in a custom unsubscribe landing pages. However, I couldn't resubscribe them again if they check the resubscribe checkbox, below are the codes that I ...
3
votes
1answer
343 views

Bracket notation in SSJS (in the Marketing Cloud)

I have a script that is retrieving rows from a data extension and then looping through said rows. The data extension is coming from a SF report so I can't edit the column names without copying it to ...
3
votes
0answers
52 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
2 3 4 5
14