Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
2answers
21 views

How to separate json response in different variables?

How do I separate this response in one variable, like I required from below response URL only in one variable? However, "BE050-A28" this value is dynamic in every response. { "vehicle": { "...
0
votes
0answers
37 views

Correctly parse JSON

I am trying to make a call to external API but I don't know how to correctly parse results. Here is the format of the response. I can correctly parse the Status, but Results is an array and nothing so ...
0
votes
1answer
60 views

How can I add data to Dataextension for SSJS

I am trying to add data to Data Extension using SSJS Script through Automation Studio. 1.I want to HTTP GET(ThirdParty's recomend) 2.I want to catch response(JSON) and add data to Dataextension How ...
0
votes
1answer
32 views

Make a call from a landing page to update only one result in a data extension [closed]

I am attempting to update a data extension that has a "@code" that I need back and an "@assiginedToo" that I need to populate with an ID. The only way to know which @code I should grab is by looking ...
1
vote
1answer
30 views

SSJS equivalent of DecryptSymmetric

Knowing that we have EncryptSymmetric and DecryptSymmetric in Ampscript, both with the ability of referencing password, vector and salt, from Key Management - is there anything similar in SSJS? If a ...
-1
votes
1answer
33 views

How to remove a record from a publication list using scripting [closed]

Can please help me to how to remove a particular record from publication using scripting(ssjs/api ampscript) Thanks, Shiva
1
vote
0answers
42 views

SSJS Script not Looping Through

I have some code which doesn't seem to loop through the i variable incrementally... any ideas where I'm going wrong? <script runat="server"> Platform.Load("core","1.1"); var DE1 = ...
2
votes
1answer
42 views

How to obtain error status of automation via SSJS

I have the below SSJS which gives the status of scheduling in automation. But it doesn't give the status of automation: For example, if my automation errored, then am getting the status '6' which is ...
0
votes
1answer
26 views

Update SQL Query Text via SSJS

I have written some simple code which i will try to loop later but I am getting no success in trying to use SSJS to update SQL queries. I don't need to perform the actual query i just need to update ...
0
votes
0answers
20 views

Using SSJS WSProxy within Postman to directly make SOAP API calls without needing the Soap XML request body

So far I've been able to use Postman to pass values to a SFMC Landing Page or CloudPage that hosts SSJS WSProxy to execute a particular SOAP API requests such as updating a data extension that occurs ...
2
votes
1answer
27 views

Not able to access token from response object via dot notation SSJS

I am not able to access the token via dot notation (from response object) - what am I missing here? Platform.Load("core", "1"); function requestToken() { var url = 'some_url'; var ...
1
vote
0answers
51 views

SSJS HTTP.Post ValidEmail with requested Access Token

I am trying to make an API request in SFMC to validate email addresses, which requires first to get the Access Token. I was able to request the access token, but then the next HTTP.Post request I do ...
0
votes
1answer
31 views

SSJS Restrict Contact

Is there any SSJS function that would allow me to restrict a contact? (I can't find anything related in the documentation) Ref: /contacts/v1/contacts/actions/restrict?type=keys
0
votes
1answer
32 views

Error executing HTTP.Post call from Microsite landing page

Here's my code below. The error happens at the first HTTP.Post call. The error message is simply: ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a ...
0
votes
0answers
25 views

How to add content to above email template assigned to Triggered Email

I have managed to initiate the Triggered Email using AmpScript in a Cloud page. Is there a way to pass in text content into the Triggered Send above the email assigned to the Triggered Email ...
0
votes
1answer
43 views

SSJS to save data into a data extension

I am really new to SSJS but what I am trying to achieve is to pass some parameters in the URL from an email and capture them in the cloud page and then save that data into a DE using SSJS. At the ...
1
vote
1answer
41 views

Displaying the publication list so the user can opt-in from a cloud page

I want to create a cloud page where it displays all the publication lists and from those user can select and subscribe in any of the publications.Just like in the subscription center. As I am new to ...
1
vote
1answer
55 views

SSJS HTTP Get method error - Unable to retrieve security descriptor for this frame

I am trying to retrieve a template-based email asset using the Content Builder API via a Cloud page. I am having trouble retrieving the template. I am not sure if it is an issue with the structure of ...
0
votes
0answers
27 views

SSJS to bulk update SQL Activities

I have many SQL Query activities each of which i need to update the query text to a) join a data extension b) add to existing where clauses to exclude the joined DE where the unique field IS NOT NULL. ...
1
vote
1answer
44 views

Automation doesn't run through SSJS when it is in a Paused state

I was able to run an automation which is in "scheduled" staus using SSJS, but when I pause it manually (status changed to "Paused") and execute the same script, the automation doesn't run. The script ...
4
votes
2answers
130 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 ...
0
votes
0answers
53 views

Issue in retrieving response body for 4xx and 5xx response code via HTTPPOST2

I am calling third party API via HTTPPOST2 using ampscript, and need response body for response codes like 4xx or 5xx. For success scenario, I am getting the response body in response parameter of ...
1
vote
2answers
74 views

Trigger ImportDefinition through WSProxy

I made a script (SSJS) to create a new Import Definition in Marketing Cloud. That works well, and if I then trigger the import manually in the GUI the import successfully completes. However, I also ...
1
vote
1answer
35 views

HTTP.Get - Need a solution for Non english xml data

I am using Server side javascript 'HTTP.Get' to retrieve Meta editor XML data. I could successfully retrieve for English documents into Salesforce Marketing Cloud. But It doesn't work for Chinese ...
0
votes
1answer
54 views

Retrieving specific Email object using SSJS

I am trying to retrieve a specific email send that has gone out previously. I have been using the RetrieveRequest object in SSJS to attempt to access the "Email" object. It has been able to retrieve ...
0
votes
1answer
24 views

Can't create Data Extension with SSJS

I'm trying to create a proof of concept data extension with one field for each unique value in a specific column of another data extension. I am intending to do this using a SSJS script run as part of ...
6
votes
3answers
60 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 (...
0
votes
1answer
55 views

How can I update a row via a filtered data extension with a value of null in ssjs?

I am using ssjs in Marketing Cloud to detect records that were not sent an email through my Journey due to not finding a matching Contact record in Salesforce. First I am setting all of the values ...
0
votes
1answer
39 views

Ouput date in ISO8601 date-time format

I need to output a date in ISO8601 date-time format in Salesforce using SSJS. Salesforce is storing in format 'Thursday, 1 August 2019 5:00 PM'. I have tried Write(current.date.toISOString()) but ...
1
vote
1answer
49 views

HTTP POST Request error “Unable to retrieve security descriptor”

When attempting to make a HTTP POST Request in server side javascript I keep getting this error, not sure what the problem is but I cant seem to fix it. <script runat="server" language="...
0
votes
0answers
21 views

How to updated the content (Add records one by one) in content block using SSJS with AMPScript in Marketing cloud?

I have done add functionality to store content in content block using ssjs. But i need updated functionality, Means whenever we give the user require info in the web form, then submit. So the content ...
1
vote
1answer
127 views

SSJS - HTTP GET for API

I am trying to return an array of Event objects using SSJS HTTP GET with an authorization bearer header. This is my current script but it isn't loading anything. Would anyone be able to assist? I am ...
2
votes
1answer
77 views

Unable to process HTTP return codes except 200

We are having an integration with an external REST API which we are invoking from a SSJS script hosted on a cloudpage. We have tried couple of ways to invoke the API Call - Script.Util.HttpRequest &...
1
vote
1answer
53 views

AmpScript and JavaScript w/Cloud Pages

My objective is to insert the subscriberkey into a data extension on JavaScript onclick event. I do not see any viable documentation that works. I've tried passing AmpScript variables to Javascript ...
1
vote
1answer
92 views

Always 2500 rows found in the filter

I am using the following script (in Automation Studio as a Script Activity) to remove all the rows of the last 30 days from a DE. The automation is run daily. I log errors and messages in a DE called ...
3
votes
1answer
65 views

Removing a row from a DE with Ampscript or SSJS in a landing page works, but the page shows an Internal Server Error (500)

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 ...
5
votes
1answer
114 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 ...
3
votes
1answer
88 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"> ...
1
vote
0answers
22 views

Can I improve this Custom Subscription Center that uses lists?

We have 3 subscription lists called: promotions, newsletter and pharmaceutical advice. As our client doesn't like the standard preference center, he asked us to custom-built it. So far the ...
2
votes
0answers
70 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"...
1
vote
2answers
47 views

Pass values using SSJS and AMPscript on email

Firstly, I apologise - I am a beginner with JavaScript and SSJS. I am trying to send an email with a CTA button that has an url to an external page, which will prepopulate values from a DE on the form....
1
vote
1answer
78 views

Create a Automation Studio Dashboard on a Marketing Cloud Cloud Page

I Want to Create a dashboard where all Automations and there status in the Account is displayed. old post on the topic I Want to push all Automation object data to a data extension. This can only be ...
2
votes
2answers
139 views

SSJS OAuth 2 Support?

I'm trying to obtain an OAuth 2 token through SSJS and getting a 400 error. Here's the code I'm using: <script type="javascript" runat="server"> Platform.Load("Core", "1.1.5"); var ...
0
votes
1answer
88 views

Retrieve the context of a running SSJS script

Does anyone know how to get the details of the parent automation from within an SSJS script? We are looking to develop a generic SSJS script that can be used in multiple automations, but whose ...
-2
votes
1answer
46 views

How to invoke a CloudPage from inside a Custom JB Activity and pass input parameters to it?

We have some SSJS/AMPScript code embedded in a cloudpage which we want to invoke from a Custom JB Activity and pass some parameters to it as input. Please advise how we can achieve this. Any sample ...
3
votes
1answer
56 views

Print reason for SQL query failing in SSJS

I built a Microsite which staff can you use to run one-off queries without having to create an activity and then run it or place it in an automation. It works great but is very basic - when you click ...
2
votes
1answer
60 views

Use SSJS to Retrieve ImportDefinition Results

I'm looking for a way to use SSJS to retrieve results for various ImportDefinitions. I see that one could do it with API (here), but I'm not certain how that translates to SSJS. Is there anything ...
0
votes
1answer
36 views

Loading time to read and display Data Extension rows with JS in CloudPages

I am trying to retrieve around 40,000 rows from my Data Extension into a CloudPage for an external 3rd party to consume this data. The loading time of my cloudpage exceeds 2min, and it makes a ...
0
votes
1answer
52 views

how to create a landing page that posts to itself and calls a SSJS function?

I am trying to implement the prunerows() ssjs function that Adam Spriggs specifies on this link, https://sprignaturemoves.com/prune-rows-data-extension-ssjs/ But i am not sure how to create a landing ...
1
vote
1answer
70 views

Is there a way to capture visitor's IP addresses and link clicked via AMPScript in a Marketing Cloud “Cloud Page”?

In Marketing Cloud, Cloud Pages, is there a way to be able to capture a visiting user's IP address, device, link clicked, and so on, via AMPScript or SSJS? I know this is possible when working with ...