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

SSJS updateDE returns null

According to the documentation updateDE should return the number of rows modified <script runat="server"> var rows = Platform.Function.UpdateDE("CustomerData",["Company","Country","Region"],["...
1
vote
1answer
154 views

how to retrieve values passed from MicrositeURL for use with SSJS

I am building a custom preference/unsubscribe center in Cloud Pages with SSJS. I'll be using MicrositeURL('xxxxxx') within the footer of emails to get to the landing page. How can I retrieve the ...
0
votes
1answer
330 views

How to catch selected radio button with requestParameter?

This it was asked before but the user deleted the question https://webcache.googleusercontent.com/search?q=cache:ZkynvIeVHUYJ:https://salesforce.stackexchange.com/questions/211141/how-to-catch-...
0
votes
1answer
438 views

Activate a Subscriber from Server Side Javascript

Is there a way to Activate a subscriber using Server Side Javascript or Ampscript. I am able to Unsubscribe an Active subscriber but not able to Activate an Unsubscribe subscriber in SFMC. Is there a ...
0
votes
1answer
177 views

What information is returned in the array from the SSJS Lists.Retrieve()

I'm doing some research into using SSJS to build a custom preference center in SFMC Cloud Pages. Could someone expound on what information is returned in the array from the Lists.Retrieve() call? ...
1
vote
1answer
323 views

Can we use templates to send emails with SSJS?

Using the Salesforce documentation I can see we can build HTML emails and use SSJS to send to lists. I wanted to know if its possible to use a predefined Email (in Content Builder) and use that for ...
0
votes
1answer
302 views

Filter a data extension in SSJS with SimpleOperator IN

I am trying to filter a data extension to only return certain rows via an SSJS automation. It works fine if I set the SimpleOperator to "equals" and the Value to a static value. What I really want ...
1
vote
2answers
1k views

SSJS Landing Page access POST JSON Request payload

I would like to POST to an SFMC SSJS Landing page using AJAX. Is there any way to access the POST JSON Request Payload using SSJS in the Landing page?
5
votes
2answers
2k 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.
0
votes
2answers
838 views

Capture JS variable with AMPscript/SSJS

I have a script with moment js library running in a landing page and the purpose of the library is to check whether today falls in Daylight Saver. If it does then the function sends a true statement ...
0
votes
1answer
251 views

Access status of last run of an automation using SSJS

I need to get the status of the last run of an automation through SSJS. The context: there are several automations that will run and if all of them are successful I need to start another automation ...
0
votes
0answers
275 views

How to set charaset as UTF-8 in HTTP GET (SSJS) method in Salesforce Marketing cloud?

I am using HTTP get method to get the data from API,But the response returned from the API is not encoded in proper format.The Same response in Postman looks perfect. The content from Postman looks ...
0
votes
0answers
96 views

URL Concatenation is not working in the content area generated by SSJS

URL conacatenation is not working in the content area generated through SSJS script .The scenario is we are generating a content through SSJS and its stored in the content area and its then pulled ...
0
votes
1answer
175 views

Creating new Portfolio object through SSJS but the status shows error

I am trying to create a portfolio object in the scrip activity using SSJS portfolio add function.I am following this link for creating portfolio but the status shows error. var newPortfolio = { ...
0
votes
0answers
109 views

Dynamic RetrieveSalesforceObjects

I'm currently building a custom preference center and want to give business users an easy option to add/map additional fields for preferences based on salesforce fields. I'm thinking about creating a ...
1
vote
0answers
138 views

HTTP GET failing

I have an activity script running a SSJS HTTP GET request. I need to get the output of this request to feed a data extension. I am using this code: var de= DataExtension.Init("dataextension_ek"); ...
0
votes
1answer
231 views

Using AMP script vs SSJS in email template for an API callout

We have created a email and for which the content is populated from a external source and we are using API callouts.The response from the API callout is very huge JSON output which comes around 5000 ...
4
votes
2answers
3k 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 ...
1
vote
1answer
111 views

Retrieve All Content Areas in a Parent Folder

I've got a simple landing page that is serving as a content reference directory so I can easily look up all content areas without going through each folder. Unfortunately, the number of content areas ...
0
votes
1answer
200 views

What is the SSJS equivalent to RaiseError in AMPScript?

Is there an AMPScript's RaiseError function equivalent in SSJS in Marketing Cloud?
1
vote
1answer
215 views

How to Batch update Salesforce Sales Cloud from Marketing Cloud using SSJS?

We have to perform a batch update in Salesforce CRM custom object based on changes within Salesforce Marketing Cloud Data Extension. How can we do this using SSJS? Although Journey Builder can ...
0
votes
1answer
52 views

How can I order an array by date and then extract only portions based on top%?

I have a list of email records that I need to order by recency, there is a field in the array called 'last_opened', and I then need to extract certain amounts only. e.g. group a - 1.6% (322 records) ...
0
votes
1answer
505 views

How can I print one Array value of a SSJS RetrieveRequest

I have made a Retrieve call using the below code, but am struggling to print the Email field values into a clean list. I can get this output and can see the email addresses are pulling through: {"...
0
votes
1answer
96 views

Get partial language URL parameters and Insert to DE in SFMC

We have an iframe form setup on a landing page with both English and French language preferences. I want to get the URL parameter that shows Language type and write that value to a Data Extension upon ...
0
votes
2answers
400 views

Updating Salesforce Object via SSJS in Marketing Cloud

I would like to perform an update on the Lead Object in Salesforce as soon as the relative Marketing Cloud Subscriber perform the unsubscribe via Mobile SMS in Marketing Cloud. I tried using ...
5
votes
0answers
206 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 "...
1
vote
1answer
226 views

Monitoring Journey entry audience

I have a journey which audience is an entry data extension. The DE gets populated daily via automation. How can I receive an email if, let's say, less than 200 contacts make it to the journey ? I ...
1
vote
1answer
981 views

Filter a data extension in SSJS

I am trying to filter a data extension to only return certain rows via an SSJS automation. It works fine if I set the SimpleOperator to "equals" and the Value to a static value. What I really want ...
0
votes
4answers
2k views

Why is SSJS HTTP Post request failing in CloudPages and Script Activities

I am trying to execute some SSJS to store my Marketing Cloud API token into a DE but the script does not seem to work when I run once, as its an activity no error messages are returned so I can't tell ...
2
votes
1answer
318 views

How to pull images from Salesforce to Marketing Cloud?

End Goal: Use sales person's profile picture in email templates. I'd like to use the profile picture so that the sales person can see, at any time, what image Marketing is using and also to give them ...
1
vote
2answers
547 views

Creating a Data Extension via SSJS SOAP call

EDIT The issue was that I have SUBSCRIBER_KEY functionality turned on for my account, so I need to set the SendableSubscriberField to 'Subscriber Key' or the call will fail. I have been able to ...
0
votes
1answer
214 views

server-side javascript array key access [closed]

If I got this SSJS object, How can I access key value from "taxes_base" property if I don't know its value? { "taxes":{ "indirect_discount":true, "taxes_base":{ "10":{ ...
1
vote
1answer
301 views

ampscript accessing dictionary object

I got a json object parsed from SSJS. This way var payload = eval( "(" + myJson.Content + ")" ); And later I pass that payload to AMPSCRIPT Variable.SetValue("@invoice", payload.invoice); How can ...
0
votes
1answer
69 views

Retrieve data from DE before post method

I am working on Marketing cloud project where I need to take input from customer and store in Data Extension and redirect them to the welcome page. I have done this but now the requirement is changed. ...
0
votes
1answer
426 views

More detailed error reporting for SSJS failing?

We have a script which runs in an automation which retrieves registration data from our events management platform. The automation recently stopped working, and the problem was with the javascript ...
1
vote
0answers
348 views

Create automation by SSJS

Is it possible to create an automation by SSJS, object type CreateRequest does not exist and I don't know how create that entity in my system. I using this code but last lines gives me an error. <...
0
votes
1answer
907 views

Variable.SetValue in SSJS not working. It is displaying as blank

The snippet below displays it prints blank. The URL variable is not setting to 'test URL' I have declared the variable @res_code at the top(not visible in snippet) Also I have tried using Platform....
1
vote
0answers
113 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",...
0
votes
1answer
301 views

AMPscript List subscribe

I'm using the following SSJS to unsubscribe a contact from a list. Just wondering, how can I use the same logic to subscribe a contact to list? Can't find anything. <script runat=server> ...
3
votes
1answer
295 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 ...
2
votes
1answer
311 views

SFMC - Use Script to Retrieve List members for * status

I am attempting to use the subscribers.Retrieve function to retrieve members of a list. However, I am hitting a roadblock with the parameters. I'm looking at member status, but I can't seem to use a ...
-4
votes
1answer
2k views

SSJS to AMP script [closed]

I am trying to retrieve data using ssjs from one DE and by using AMP script should populate those values to another DE. I am getting with AMP to ssjs but I am not getting with SSJS to AMP. Can anyone ...
0
votes
2answers
592 views

SSJS to delete files on enhanced FTP

I have a Tracking Extract which pushes the Zip file to Enhanced FTP. I want to delete these files after they have imported into a Data Extension How can I do that? am thinking of writing an SSJS ...
1
vote
1answer
552 views

How to resubscribe a subscriber which is already unsubscribed from All Subscribers List

I have used this code to get a subscriber from particular list but I am trying to get from all subscribers list. It's not working for that. %%[ var @ll_sub,@emailaddr,@process_subkey,@subscription,@...
1
vote
2answers
502 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 ...
0
votes
1answer
1k views

Create a Complex Filter Definition via SSJS

I am looking to do a 'Create Filter Definition' (to initially create these filters) and then an iterative 'Update Filter Definition' to mostly automate our constantly changing campaign requirements - ...
0
votes
1answer
71 views

Landing Page Error when using do - while loop: startIndex cannot be larger than length of string

I wanted to test the script below in Landing page but I am getting the following error: startIndex cannot be larger than length of string Any suggestions why this error occurs and how to fix it? ...
1
vote
1answer
185 views

Can server-side javascript detect new users added to a list/data extension?

I want to add a user to a list or possibly update a user(through the API probably), and from there fire off an email. Now I know I can do an hourly script to run a SSJS to fire the emails, but I can'...
1
vote
1answer
1k views

JSON objects from AMPScript to JS and merge them with JS and output it to a AMPScript variable

I need to merge JSON objects generated with AMPScript inside SSJS and write it to an AMPScript variable. AMPScript + JavaScript code: %%[ VAR @JSON1,@JSON2 SET @JSON1 = "{"car":{"brand":"...
2
votes
1answer
1k views

Landing Page post to itself and run SSJS

i found a great blog post by Adam Spriggs https://sprignaturemoves.com/prune-rows-data-extension-ssjs/ He mentioned to execute this function be built a landing page that posts to itself and calls ...