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
2
votes
2answers
94 views

Updating Send Classification using API or ssjs [closed]

Anyone has updated Send Classification(Name and External Key) using API or SSJS? If someone can give some tips on this, would be very helpful. Thanks
0
votes
0answers
60 views

For loop and insertData with ssjs

Anyone experience with using for loops to insert data into a data extension dynamically? I normal javascript I would use a forEach statement. I have the following JSON array (retrieved using HTTPGet) ...
0
votes
1answer
175 views

System.Collections.Generic.Dictionary error using SSJS HttpRequest

I am trying to complete a DELETE request using SSJS on a landing page, using API mocking tools (beeceptor.com) I'm able to fake the API calls to see how the page reacts. Calling the DELETE request, ...
0
votes
1answer
293 views

How do I get post data using SSJS?

I have a CloudPage which I post to using form data, using SSJS I want to retrieve the url form input. How can I do this? Below you can find the code I have used but this doesn't appear to work, I've ...
0
votes
1answer
887 views

Creating Query Definition with SSJS

I am trying to create Query Definition using SSJS but its not working for me. my code as follows: <script runat="server"> Platform.Load("Core","1.1"); var queryDef = { Name : "Example ...
0
votes
0answers
65 views

Programmatically adding activities to automation

Creating activities using SSJS, e.g. Query Activities is relatively well described. However, when a newly created activity needs to be added to an existing automation, I fail to find any documentation ...
-1
votes
1answer
69 views

How to create an outbound API call from SFMC using SSJS

Use Case - get data from external web services and store the data (response) inside SMFC data extension field. *New to API Calls - detailed step by step guidance would be really helpful. The ...
1
vote
1answer
80 views

Retrieve mobilepush contacts

Is there a way to retrieve SFMC mobilepush contact data/activity history data via ssjs/script that is generated in automation studio? For example, mobile contacts who are opted in who have been in a ...
0
votes
1answer
39 views

Delete bulk TJob Ids from _Job system data extension in SFMC [closed]

Kindly, let me know to delete a bulk tracking job records from _Job system data extension in marketing cloud or if possible using REST API in SSJS/Ampscript please share the code? Thanks, Manjesh
0
votes
0answers
43 views

Marketing Cloud - triggered send email template error handling

I have a triggered send email consisting of Ampscript, in this template we are using a lot of personalization which is coming through XML in the triggered send data extension. So the issue is if the ...
0
votes
1answer
114 views

How to validate a field value entered in form against Data Extension value using AMP Script?

I have a requirement where users are supposed to enter their Code to validate before redeeming it. The page will have one field to enter the 'Code' and a button to verify if that code exists in Data ...
2
votes
0answers
81 views

SSJS: Function returns value without return

I hope someone can help me to understand the following behaviour: <script runat=server> Platform.Load("Core", "1.1.1"); function test(args) { for (var i = 0; i < args.length;...
0
votes
1answer
70 views

How can I retrieve FolderID using SSJS marketing-cloud ssjs

How can we retrieve the FolderID for emails, queries and data extensions using SSJS in marketing cloud ? I couldn't find any value associated with folderID from returned array of emails, queries. ...
0
votes
1answer
765 views

SSJS HTTP.Post throws error instead of returning status code

I am banging my head against the HTTP.Post function. The documentation says: Performs an HTTP POST using the provided information against the passed URL. The function returns a JSON object ...
0
votes
2answers
114 views

Can I access Content Builder API using script activity in automation studio? If yes, is there some good documentation that I can follow?

I wanted to use the marketing cloud REST API using script activity to perform various tasks such as uploading content in content builder, changing the customer key for that content based on values in ...
0
votes
1answer
52 views

Unable to create TriggeredSendDefinition

I am unable to create TriggerSendDefinition using SOAP API call in POSTMAN. I am following the official docs to create the TriggersendDefination. Not sure where I am doing wrong. Please find the below ...
0
votes
1answer
176 views

SSJS Split String

How to use split function in SSJS to split String?  In my case, I have given the String and , the way I want to split is as follows : My String : I want 2 splits dfc_1 : dfc_ and 1 dfc_45932 : dfc_ ...
0
votes
1answer
94 views

SSJS: Does SetCookie / GetCookieValue only be execute after script has been executed?

I am trying to play around with cookies in SSJS and run into some problems. First of all, I have a few possible solutions for this problem but this question is more about getting an understanding of ...
0
votes
0answers
63 views

Script Activity Outputs

I creasted a SSJS in Marketing Cloud under --> Automation Studio --> Activities --> Script , I was curious to know how I can view the results of Write statements in the script? I am able to store data ...
1
vote
1answer
197 views

SSJS - Rows.Retrieve() return empty array

I tried to get all rows from DE by DE name, I got an empty array. For the test, I tried to add a new record to this DE before the read function. Edit: This is a Shared Data Extension My code: &...
1
vote
1answer
63 views

Trigger Send email - completed count and other details for reporting

I've created a Trigger Email (Email Studio> Interactions> Triggered Emails) whose external key is 2241. This has 64 in completed count and 0 in queued and errored. I'm trying to get this 'completed' ...
0
votes
1answer
274 views

Trying to add a new row to a “Shared Data Extension” using SSJS

I'm trying to add a new row to a Shared Data Extension using SSJS. When I try to run my code I got this error: "There was an error Adding the row(s)." In another environment of Marketing cloud, the ...
0
votes
0answers
35 views

Allocate DataFolder contentType to retrieve object?

I am using WSProxy and trying to find a solution for the following problem: Problem How do I check if a DataFolder is empty. Meaning it has no child DataFolders or any respective objects. For ...
0
votes
1answer
116 views

How Do I Send an HTTP POST API Call Through a Script Activity Using Basic Auth?

I have seen a few posts about how this can be done using oauth, but I need to use basic auth and I can't seem to get it to work. Below is an example of the code I'm using. <script type="javascript"...
0
votes
1answer
447 views

How to overcome 2500 SSJS limit to delete more than 2500 DE records at once?

I created a SSJS script to delete certain records from a DE which seems to work fine for less than 2500 records. But once the number of records that need to be deleted surpass 2500 records, then it ...
0
votes
0answers
54 views

Try/catch not catching 500 error on CloudPage

I have a CodeResource CloudPage that contains only SSJS that is wrapped in one big try/catch, like this: <script language="javascript" runat="server"> Platform.Load("core", "1.1.1"); try { <...
0
votes
0answers
56 views

Debugging a CloudPage with AMPScript loop with SSJS inside

I need to debug a CloudPage consisting of an AMPScript for loop. In a loop it makes a http request, parses the result with parseJSON and sets a variable via SSJS, and then processes the result with ...
1
vote
1answer
203 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 ...
2
votes
2answers
383 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 ...
2
votes
2answers
907 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 ...
0
votes
1answer
1k views

i have created a simple html survey form how to get radio buttons values selected by user to a data extension [duplicate]

i have created a simple html survey form under cloudpages which constains several questions with radio buttons and some with text boxes for answers. I want to know how to get radio button's values ...
0
votes
0answers
36 views

Passing value to AMPscript varible from SSJS is adding hidden chars

From some reason, using the following SSJS code: Platform.Variable.SetValue("@sid", missed[0]["SubscriberKey"]); Adds some hidden characters to the end of the string. %E2%80%8E is added, which is ...
0
votes
2answers
229 views

Marketing Cloud: Removing multiple rows from a data extension via SSJS [duplicate]

In Marketing Cloud, we would like to remove multiple rows based on the EmailAddress column, which is the primary key in our permission data extension. Now, we tried using the code snippet for Server-...
0
votes
2answers
70 views

Can I update a DE that has no primary key using SJSS? What if there is truly a unique value it's just that no primary key was set originally?

My business partners want an Anniversary journey (based on when a consumer came into our Welcome journey). The welcome journey is based on campaign data from SF since we do have the MC connector. ...
0
votes
1answer
144 views

Push Data Extension records into Salesforce CRM custom object

I am working on the requirement where we want to push records from the Data Extension into Salesforce CRM custom Object. Source Data Extension is updated every 24 hours. We are thinking to create a ...
1
vote
0answers
178 views

Retrieving data from a shared data extension with SSJS

I have a hard time figuring out how to adjust the code mentioned below to read data from a shared data extension. Some details about the situation: The script is executed from a child business unit ...
6
votes
3answers
215 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
68 views

Retrieve Records added into a Data Extension on the last hour using SSJS

I have a Filtered Data Extension "Audience Segmentation - Python Developers" with the following fields: - SubscriberKey - Name - ProgrammaticLanguage - DateAdded (default value: Current Date) I ...
0
votes
0answers
42 views

“Delete DE” SSJS script is not working within my automation

I have an automation that fires an SSJS scripts at the end of it which is supposed to delete the contacts in the target DE (yes, the target DE is Sendable). When I test the following script in a ...
1
vote
1answer
79 views

Delete contacts through rest api

I am trying to automate the deletion of contacts based on a data extension. I am using this script but it keeps giving me the error "ERROR: Error has occurred". Any idea what I might be doing wrong? ...
0
votes
1answer
214 views

Uploading image via Cloud Page form and then retrieving Content Builder image URL

I have created a Cloud Page with a form to upload an image using this tutorial: https://sfmarketing.cloud/2020/02/29/create-a-cloudpages-form-with-an-image-file-upload-option/. I am able to ...
0
votes
1answer
66 views

Updating boolean value with SSJS Rows.Update returns 500 error

I am trying to update a boolean column (new) using the following SSJS: var targetDE = DataExtension.Init(DE); var processing = targetDE.Rows.Update( { ...
0
votes
1answer
86 views

Create a form in cloudpage [closed]

I am trying to make a form on a cloudpage, I have created the DE where I want to send my data. I would like to receive the email and the user's name on the form. How can I make the email through a ...
0
votes
1answer
254 views

How do I access objects in HTTP Post response using SSJS?

I am using the following code to make an API request to a third party system: var req = new Script.Util.HttpRequest(URL_ENDPOINT); req.emptyContentHandling = 0; req.retries = 2; req.continueOnError = ...
0
votes
1answer
183 views

Using Script.Util.HttpRequest returns failure

I am trying to make a request using Script.Util.HttpRequest instead of HTTP.Post, as I will need to use the PATCH request type in a subsequent call. In my test POST call I get the following error: ...
0
votes
2answers
305 views

How can I get nth item from array in SSJS

I am building an array in SSJS, without knowing the key how can I get an item out of the collection with just the position number? i.e. 2nd item in array. Array Code: var array = []; array['1'] = "...
2
votes
4answers
215 views

Update SQL Query in child BU from a parent BU using WSProxy

Could you please let me know what's wrong with my code? <script runat="server"> Platform.Load("core", "1.1.1"); var prox = new Script.Util.WSProxy(); //Switch context to different BU. Change ...
0
votes
2answers
205 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"],["...
0
votes
1answer
152 views

Why cant I print out my array of objects in SSJS

I am trying to prepare a list of objects that I am pushing to another service, I have generated a list of objects that need to be sent. For some reason I cannot stringify the array. This is my code: ...
1
vote
0answers
90 views

GET Response containing png image in Marketing Cloud

We are using this api (get method): https://rapidapi.com/qrcode-monkey/api/custom-qr-code-with-logo In order to create QR images on the fly when sending emails to our customers from Marketing Cloud. ...

1
3 4
5
6 7
14