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
1 vote
1 answer
24 views

Unable to Insert Date into Data Extension via SSJS

The Problem I am trying to convert a date-time field that is retrieved from a WSProxy call previously. The date-time is provided to me in the format of YYYY-MM-DDTHH:mm:ss.sss, trying to insert this ...
user avatar
  • 181
1 vote
1 answer
63 views

Data Extension Caching when doing Lookups

Script description: There is a script that aims to retrieve up to 200 records from the Data Extension, perform some manipulation with retrieved values and lastly delete processed records from the ...
user avatar
  • 2,306
0 votes
1 answer
33 views

Getting error when upserting data extension with SSJS

I am trying to query the contact and another data extension and then upsert a third data extension called customerETL. Everything works if I hardcode values into the function but when I pass values ...
user avatar
  • 390
0 votes
0 answers
15 views

How to prevent retrieving Private Lists in Marketing Cloud?

I'm trying to retrieve Subscriber's public lists only, but it keeps returning public lists + a private list called "All Subscribers". I've tried both following methods but neither worked, ...
user avatar
  • 13
0 votes
1 answer
42 views

Moving over 2000+ old Data Extensions to new folder for review/delete

I am trying to move multiple old DEs into a new folder. And, with my limited experience with SFMC Objects & WSProxy/SSJS, I dug deep into multiple resources & samples codes like (Zuzanna - ...
user avatar
0 votes
1 answer
29 views

Why does my publication list array return undefined in Vuejs?

I'm learning to build a custom preference centre and trying to display all the lists for a subscriber. I retrieved all the lists like below: <script runat='server' type="text/javascript"&...
user avatar
  • 13
0 votes
0 answers
32 views

Filter criteria for Rows.Retrieve to include/exclude null and empty string values

I've been struggling with getting the complex filter together that would take into the account that a field may not actually be null but could be empty string ("" in mySQL) So if I do var ...
user avatar
  • 1
2 votes
0 answers
17 views

Trying to make API call to external server from SFMC

I'm trying to make API call to external system from a Cloud page, but when I publish I'm getting response Response:nullresultString. Is it something do with IP whitelisting or it's a code error. Below ...
user avatar
  • 31
1 vote
1 answer
49 views

How to Make API Call from SFMC Cloud page to External System

I'm trying to make API call to external system from a Cloud page, but when I publish I'm getting response Response:nullresultString:. Below the code details. Can someone please help me this. Thank you ...
user avatar
  • 31
0 votes
0 answers
33 views

Help with Script.Util.HttpRequest Error

We are testing the connection establishment with our client url. while establishing the headers in postman it is successful with code 200. While we are trying to create a test landing page with the ...
user avatar
0 votes
1 answer
28 views

Unable to retrieve ReplyToAddress & ReplyToDisplayName

I am not able to retrieve ReplyToAddress & ReplyToDisplayName from TriggeredSendDefinition. Currently, I have successfully retrieved FromAddress & FromName from TriggeredSendDefinition using ...
user avatar
  • 141
0 votes
1 answer
27 views

FilterDefinition Client IS property missing, Marketing Cloud

I faced strange situation. I am trying to retrieve all Data Filters from the specific Business Unit from salesforce Marketing Cloud. on the marketing cloud SDK help page there is info that ...
user avatar
  • 1
0 votes
1 answer
35 views

Testing retrieving Automation Statuses in Batches. Error looping through results

I'm building an automation to retrieve the latest statuses for a number of specified automation instances. The flow is something like run SJSS to retrieve all statuses for the automation instance and ...
user avatar
  • 103
1 vote
1 answer
34 views

Running a script on row update or addition in marketing cloud

I have a DE in marketing cloud which has fields for marketing permission.The permission should be sent to an external database using an api whenever a new row is added or updated.I have to use server ...
user avatar
0 votes
0 answers
27 views

Salesforce Marketing Cloud code resource can't process an XHR request from an amp-form component

I am using an amp-form inside a dynamic mail and want it to send some data to a code resource sitting on a Salesforce Marketing Cloud org. The request seems to be fine, but it never reaches the code ...
user avatar
0 votes
1 answer
53 views

SSJS date time filter for previous day

I'm having a problem in pulling in only the records with a ModifiedDate from the previous 24 hours from this SSJS filter when trying to access ListSubscribers object. I can use it to find a specific ...
user avatar
0 votes
0 answers
27 views

SFMC - Use image in SFTP in an email

An external platform generates QR images and leaves them in SFMC's SFTP. I want to use these images to insert them into an email. I know that if the image is in a Content Builder folder I can use the ...
user avatar
0 votes
1 answer
155 views

UpdateSingleSalesforceObject - when does it actually return 0 value?

The Salesforce AMPscript function UpdateSingleSalesforceObject returns 0 for failure according to documentation. However, all failures of the function we have simulated (for example: invalid SF id, ...
user avatar
  • 213
0 votes
2 answers
54 views

Retrieve all Data Extensions across all running journeys

I found out on this forum there is an option with Marketing Cloud API to retrieve all the Data Extensions associated with Journeys. When using Postman, the request below works perfectly GET /...
user avatar
  • 3
1 vote
1 answer
45 views

Extract Text Version of the email body with no html tags using REST API from SFMC

I was trying to extract the email body (text version) with no html tags from SFMC. But I had some hard timing on how to filter out the nodes in the email content to get the expected result, I couldn't ...
user avatar
  • 31
0 votes
0 answers
34 views

Identify Query Activities within Automation using ssjs

I am trying to identify all the activity queries within an automation using ssjs. I came up with the following code but it seems not working rightnow. Have you guys ever had this problem? Did you ...
user avatar
0 votes
1 answer
50 views

How to update salesforce custom object (Customer__c) OptIn field value from Marketing cloud (Customer DE) OptIn attribute value using AMP script

I have a scenario, 1 DE (Customer DE with SubscriberKey, OptIn, Status, OptInDate attributes) with some records. I want to update the salesforce Customer__c object records OptIn (Yes/No) if ...
user avatar
  • 3
0 votes
1 answer
26 views

SSJS date time retrieval error

I am trying to retrieve the date-time in SSJS. I have created the below code on the cloud page, to retrieve the locale date time. <script runat="server"> Platform.Load("Core&...
user avatar
  • 643
0 votes
0 answers
38 views

SSJS Try/Catch Behaving Different in Different MIDs

For context, I have two different Marketing Cloud orgs, one that we will call PROD and one that we will call UAT. They are completely separate. They are each connected to a Salesforce instance, PROD ...
user avatar
  • 97
0 votes
2 answers
30 views

Store logs separately generated by logunsub event in a Data Extension. The Response Returned is in HTML and not in JSON format

UnsublogEvent is working as expected. the only thing is I have to pass the response back to the data extension. Response = Platform.Function.InvokeExecute(lue, statusAndRequest); above row gets the ...
user avatar
0 votes
1 answer
79 views

SSJS Lookup All Rows from Data Extension Column as Array

So I have a "Master" Data Extension that has a ton of columns and rows (millions), and one column needs to have some changes made for specific rows based on Customer_ID. I have a ...
user avatar
  • 27
0 votes
1 answer
33 views

To get data of all automations created in BU with their status

I tried below code to run in my BU to retrieve records, but it does not publish anything. <head> <style> body, a, input, td, th {font-family:sans-serif; font-size:12px;} </style&...
user avatar
0 votes
0 answers
45 views

SSJS Array.prototype throws jintException when used with DataExtension.Retrieve value of test

I have stumbled across another interesting case with SSJS and Salesforce Marketing Cloud and hope for some ideas on why this occur and furthermore, how I may can prevent this from happening. On a ...
user avatar
  • 466
0 votes
0 answers
45 views

Break ampscript resultset when spaces are found and store them in separate variables

Currently I have script to fetch values from a DE SET @retrieveRequest = CreateObject("RetrieveRequest") SetObjectProperty (@retrieveRequest, "ObjectType", "...
user avatar
0 votes
1 answer
65 views

Can I trigger a specific step of automation I want to start ? Using SSJS

I have this code that Start my automation, but I also would like to say what of steps start and finish Like : I just want that step 3 start and finish Follow the code: <script runat="server&...
user avatar
1 vote
1 answer
52 views

Cannot create a Data Extension using SSJS in CloudPage but same code works in Automation Studio

I have created a HTML landing page like below, which takes the input from the user for Data Extension name <html> <body> <h1> Create a new Data Extension </h1> ...
user avatar
  • 11
0 votes
0 answers
40 views

Update date time in SFDC using SSJS and ampscript

I am trying to update the date time field in service cloud using automation studio script activity. So the code is updating date and time after automation is completed but the problem is minutes are ...
user avatar
0 votes
0 answers
39 views

Has more rows and WSproxy to retrieve Lists, no results

I want to retrieve all records from my list, but I'm having problems to do it The result that was displayed in my web page is just "[]", none subscriber are coming, why? Follow the code : ...
user avatar
0 votes
1 answer
56 views

What is the flow that happens when submitting the form on a cloud page using Axios/ajax?

I am trying to implement the solution given by this website, to start an automation from a cloud page. There are 3 parts of code. HTML page (understood this) form-handler code with SSJS (understood ...
user avatar
  • 11
0 votes
0 answers
12 views

Create JSON Response in SFMC? [duplicate]

Is it possible to create a JSON payload and return it to Mulesoft? Example: Mule sends a request to my Cloud Page The CP performs some logic and if successful, I return a JSON body. Some reasons for ...
user avatar
0 votes
0 answers
36 views

Issue when creating a Data Extension within shared folder using SSJS

I could create a Data Extension successfully within any folder inside Data Extension parent folder using the below code. But when I do it for Shared Data Extension, I am not successful, could anyone ...
user avatar
0 votes
0 answers
21 views

SSJS RegExp Are Broken? [duplicate]

The Regular Expressions in SSJS Email Studio seem to be broken or have different results than expected, Is anyone able to shed some light on this discrepancy and how I can work around this? Thank you. ...
user avatar
  • 164
0 votes
1 answer
77 views

SSJS API call with form-data Content-Type

I am trying to make a request to an external API with SSJS and I have found this post where Eliot Harper posted a solution. I have made a lot of API calls using SSJS but with Content-Type JSON. Now I ...
user avatar
  • 31
0 votes
1 answer
37 views

WSProxy Data Extension AddOnly bug

I'm trying the following code: Platform.Load("Core", "1"); var prox = new Script.Util.WSProxy(); function addDE(DEKey) { var updateObject = { ...
user avatar
0 votes
0 answers
25 views

Is there a way to create a utility to retrieve Data Extensions associated in Journeys

I have taken over an up and running account with no visible mapping of Data Extensions with Automations or Journeys, is there a way using SSJS I can retrieve the information and there by associate a ...
user avatar
0 votes
0 answers
41 views

I'm having problems with inserting subscribers in my DE

I want to insert data in my DE, but instead of inserting each subscriber inside a line, it's putting all the text on my page on one line, how do I fix this? The Subscribers that I retrieve in my web ...
user avatar
1 vote
1 answer
57 views

Code disappears from Cloud Page after saving or publishing in SFMC

I am building a setup to trigger an automation from the cloud page by following this guide - https://ampscript.xyz/how-tos/how-to-start-status-of-automation-from-marketingcloud-form/ When I try to add ...
user avatar
0 votes
1 answer
71 views

Not able to create an EMAIL MESSAGE using SSJS in Marketing cloud?

I am trying to find a way to create an email with a click from the browser using Javascript client side & server side ( AJAX ), but now having issues with SSJS, I tried to retrieve the id of the ...
user avatar
  • 160
1 vote
0 answers
47 views

How to create a Triggered Send Definition using SSJS?

I want to create a triggered send definition using SFMC SSJS. This should be possible using either the TriggeredSend Platform object's Add method or via WSProxy. However, I can not get either to work....
user avatar
  • 11
0 votes
1 answer
52 views

Prevent AMPscript from executing in view online link (MC)

I have a process set-up where people can confirm they have received a message via A Cloudpage. If they open the Cloudpage a field in Salesforce is updated saying they have confirmed. On the object in ...
user avatar
2 votes
0 answers
46 views

Unable to update Data Extract activity via /automation/v1/dataextracts/{{dataExtractDefId}}

I am facing an issue where I am not able to update the DataExtract (File Convert) activity via Rest below API in SSJS script activity. In the API response I am getting below error API Responsse : {&...
user avatar
0 votes
0 answers
32 views

Contact delete in Marketing cloud- Which account id we have to use if we have multiple business units in payload

Need a clarification in contact delete by lust reference. We have a parent BU (business unit) at the top of the tree, and one of the other BUs is TEST. In TEST we have created an Installed Package ...
user avatar
  • 1
0 votes
0 answers
42 views

Access Token using Script.Util.HttpRequest

Sometime due to server or network error, failed to get accessToken in SFMC. shall we use Script.Util.HttpRequest and with req.retries is more than 1 as mentioned in the below code? Need advice if I am ...
user avatar
0 votes
0 answers
49 views

Cannot delete Content Builder Asset using SSJS

I am trying to delete asset using SSJS (CloudPage) so that we can automate the deletion of unused assets from Content Builder. I could not find SFMC documentation for DELETE method but could see that ...
user avatar
0 votes
1 answer
44 views

Does WSProxy Calls consume SFMC API limits?

We have a use-case where we have to find out all the Data extensions present in a Business unit. We can achieve this by using the WSProxy Retrieve option or SSJS RetrieveRequest approach. As the ...
user avatar

1
2 3 4 5
17