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

How to retrieve "Marketing Cloud Administrator" Role with WSProxy/SOAP?

Why can't I retrieve the "Marketing Cloud Administrator" Role using WSProxy or SOAP? Have tried from parent BUs in multiple SFMC instances. It's mysteriously absent. If I drop filter and ...
Adam Spriggs's user avatar
  • 30.2k
0 votes
2 answers
679 views

Filtering fields for a JSON output in SSJS

I'm building a SSJS custom API endpoint as a code resource page and have the following code which works fine but I need to limit the fields that are returned from the Data Extension and then placed in ...
Ruskers's user avatar
0 votes
1 answer
95 views

Workaround for SSJS activity that stop and pausing issue

I have this snippet that works partially (trying until 2000 records), but the automation or the cloudpage stop and finish before processing all the data; How to work with WS PROXY with the functions ...
João's user avatar
  • 53
0 votes
1 answer
194 views

Return Null - Rows.Retrieve() + Platform.Function.ParseJSON

i'm trying to get a specific field in a ssjs request, but the Platform.Function.ParseJSON returns null with the Stringify. Whe i try without the 'Stringify' returns 500 erros but the 'Rows.Retrieve' ...
João's user avatar
  • 53
0 votes
1 answer
328 views

UpdateDE with SSJS and Multiple Conditions

I haven't seen any questions or answers that pertain to this exact type of situation, so I am hoping for a little help. I'm trying to update a bit of SSJS that I use to essentially find-and-replace ...
Eduardo's user avatar
  • 27
2 votes
1 answer
658 views

Can you move Automation Studio activities to different folders programmatically?

I am currently trying to programmatically sort out Automation Studio activities (e.g. Email, SQL Query, Filter, and Script activities) into designated folders. I have started with Filters, based on ...
Niko's user avatar
  • 2,650
0 votes
1 answer
272 views

How We can update All Subscriber object while sending an email?

I am trying to update the status of the User from Unsubscriber to Active at the time of sending an email, is there any way we can do while sending an email? I tried the code on the Cloud page and it ...
Marketing cloud Geek's user avatar
0 votes
2 answers
333 views

Get Salesforce access token from MC cloudpage?

I'm trying to get the Salesforce access token from a connected app in MC and can't get the response. I tried it on Postman through Form Data and could get the token though. Really appreciate who can ...
Duc Le's user avatar
  • 2,603
0 votes
1 answer
282 views

Get request in SSJS on cloudpage results in 500 error

I'm attempting to send some data via a GET request in SSJS on a CloudPage. The code below is throwing a 500 server error. I'm assuming that means there's something wrong with the syntax but I can't ...
K K's user avatar
  • 185
0 votes
1 answer
222 views

How to read a XML in a DE FIELD using SSJS

I have a DE call 'RESULTDE_2' where i receive a XML like this <?xml version='1.0' encoding='UTF-8'?> <request xmlns="http:/service_request"> <queryAttributes> &...
João's user avatar
  • 53
2 votes
0 answers
202 views

SSJS Script Activity Fails to Update DE

Issue: Target DE, CustomerOrders, is not updating with the expected output, OrderId and CustomerId for all Orders. However, the script runs with no errors and logs the Success DE and the Error DE. DE'...
MarquezMoore's user avatar
0 votes
1 answer
488 views

Access Synchronized DE with SSJS

I want to use script activities within automations instead of query activities, however, I am unsure if I can access the synchronized DEs via SSJS. I have tried researching this, however, I have been ...
MarquezMoore's user avatar
0 votes
1 answer
229 views

SSJS WSProxy Create BounceEvent

I am Adding new subscriber to marketing cloud from another system. Some of the subscriber are hard bounced and have a number of bouncecount. I can create subscriber with Active , Held and Unsubscribe. ...
Chandrashekhar Dautpure's user avatar
2 votes
1 answer
340 views

SSJS - left shift operator (<<) and 2's Complement different behaviour than in JS

I hope someone has some experience with left shift (<<) and 2's Complement in SSJS and can help me to confirm my assumption and suggest a better approach for that problem. Assumption SSJS is ...
shd.lux's user avatar
  • 466
0 votes
0 answers
817 views

500 internal server error when using RetrieveSalesforceObjects when Contact is abscent in CRM?

I am having an issue working with RetrieveSalesforceObjects Method, I am having 500 interval error whenever I am having a wrong contact id, I tried to follow the recommended method, check %%[ Set @...
TaouBen's user avatar
  • 154
0 votes
0 answers
139 views

ClaimRow in SSJS does not work

I have wrapped AMP script function ClaimRow in to the SSJS it works and changes the boolean field to true but when I do lookup rows this change is not visible.. I had issue in the past and that is why ...
martechnotes.com's user avatar
0 votes
1 answer
1k views

Contact deletion in Child BU

I've successfully processed contact deletion in Parent business unit, but I'm having trouble with setting automation program for deleting contacts in Child BU. As far as I know, the contact deletion ...
Lilyn's user avatar
  • 15
1 vote
0 answers
862 views

CloudPage UTF-8 encoding issue - SSJS / AMP

While creating cloud pages I would like to debug the pages and don't want to wait every time somewhere between 5 and 15 minutes for the page to be re-published. That's the reason why we are using a ...
Robert's user avatar
  • 56
0 votes
1 answer
410 views

Is it possible to pause an automation using SSJS in SFMC?

This code temporarily pauses the automation until the scheduler time is reached. After that it completes the automation and sets scheduler back to 'Active' state. Is it possible to permanently set the ...
Diksha Ahuja's user avatar
0 votes
0 answers
118 views

Access Data Extensions in SJSS script

In this code: if (authobj.access_token) { var del = HTTP.Post(authobj.rest_instance_url+'contacts/v1/contacts/actions/delete?type=listReference', 'application/json', '{"deleteOperationType&...
Al Lemieux's user avatar
0 votes
1 answer
678 views

SSJS Automation Studio - Read imported CSV file

I'm new to SSJS and Automation Studio. What I'm trying to achieve is a simple automation based on the CSV File Drop - File Drop -> Script After a CSV file was dropped into a specified location, ...
Kosmetika's user avatar
  • 103
1 vote
1 answer
530 views

SFMC - automation to populate JSON with content from Data Extension

I have some data in a data extension that i want to have publicly available in JSON format (so it can be be used on the front-end of other external websites). Could do Ampscript/SSJS directly on a ...
Hyldig's user avatar
  • 11
0 votes
1 answer
215 views

Rename columns in Data Extensions programmatically

Is there a way to rename column names with WSProxy or another SSJS method in DEs? Columns have data in there so I cannot remove and add again. EDIT: I get this in error message when using WSProxy to ...
martechnotes.com's user avatar
0 votes
2 answers
947 views

SSJS - Cannot get the result of post request

I'm trying to send a post request via SSJS var url = 'https://th-apex-http-callout.herokuapp.com/animals'; var payload = '{"name":"wesh moose"}'; var req = new Script.Util....
MonaimRQ's user avatar
1 vote
1 answer
238 views

WSProxy HTTP POST Request only runs a handful of records at a time before erroring and pausing

I'm leveraging SSJS WSProxy's HTTP Request to send a payload over to a third-party server. The payload is essentially a data extension's information that is being looped over until all records are ...
Julie Nguyen's user avatar
0 votes
1 answer
1k views

How to fetch a variable declared in ssjs script into client side script

I am storing the value of lookup function into a variable say " var temp;" In ssjs script. I want to fetch this variable in client side script. I am using Console.log(<ctrl:var name=temp /...
jay's user avatar
  • 13
4 votes
1 answer
274 views

automation/v1/filetransfers - patch endpoint not working

For a specific usecase, I need to do dynamic csv exports from SFMC to an external serveur (s3). the dataextract works well. I can browse a list of DE, modify 1 temporary dataextract activity (by ...
joe_le_rap's user avatar
0 votes
2 answers
1k views

SSJS try and catch and Ampscript raise error

At the moment our emails are using a try and catch SSJS wrapping and stringify to log the error into a DE. We need to be able to catch any error happening due to the use of different blocks. At the ...
SYUYDY's user avatar
  • 355
0 votes
1 answer
588 views

Script.Util.HttpRequest returns no content

I try to Authenticate in salesforce to retrieve some info. I need to do this from SSJS. But when I try to make a POST call to https://login.salesforce.com/services/oauth2/token I get no content in ...
Viktor Husiev's user avatar
0 votes
1 answer
1k views

Runtime error in Marketing Cloud Automation

I am facing an issue that my automation will throw out a runtime error if it already ran about 30 mins and hadn't been finished yet. I checked and only a part of the data (a few hundred records in the ...
Duc Le's user avatar
  • 2,603
0 votes
1 answer
248 views

Save API Call Response

I need to create a job that monitors the delete jobs that are running in our BU every day. I managed to use this API (https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/...
Alex's user avatar
  • 158
0 votes
1 answer
957 views

Rows.update data extension function

What is the error in this code: <script runat="server" language="JavaScript" executioncontexttype="get"> Platform.Load("Core", "1.1"); ...
jay's user avatar
  • 13
0 votes
2 answers
690 views

How to check if data in data extension is present or clear by someone accidently using SSJS?

We are adding below code to check if Data extension is present or someone has deleted accidently , as we are fetching content ( with only one row) from DE to display on a cloudpage if someone delete ...
JNC's user avatar
  • 39
0 votes
0 answers
97 views

Script activity not pausing and deleting the TS

I am trying to Pause and Delete the Triggered sends present in out account which were created/used before 3 years. Below code works fine in a CloudPage but does not perform any action when using it in ...
Sanket kharwade's user avatar
0 votes
1 answer
199 views

ssjs not retrieving DE records

I was able to retrieve the records from a DE in one of the SFMC account but is not working for other account. Is there something else to be included in below ssjs code? <script runat="server&...
Sanket kharwade's user avatar
1 vote
1 answer
620 views

Retrieving data extension data from a WSProxy retrieve

I'm drawing a total blank. I have the following code to retrieve data from a data extension: <script type="text/javascript" runat="server"> Platform.Load("Core",...
Mike Marks's user avatar
0 votes
1 answer
215 views

how to get records from data extension with matching user's resident id in lookup platform function [closed]

I have a data extension with columns: resident_id preference_name preference_value here preference value is a boolean field. I am using lookup function to get preference_value with matching user's ...
jay's user avatar
  • 13
0 votes
1 answer
554 views

Marketing cloud page insert row using onclick event

I have this image <img src="%%=v(@link)=%%" onclick="registerClick()"> and the following function function registerClick(){ alert('click'); %%[ outputline('OUTPUT') ]%%...
Tiago Pereira's user avatar
0 votes
1 answer
362 views

SFMC - Getting content builder template last modified date using QUERY or SSJS

I'm trying to get the last modification date of a template that lives under content builder in salesforce marketing cloud. Is it possible to get it using SSJS or QUERY at all? UPDATE: Preferable to ...
Joseph's user avatar
  • 71
0 votes
1 answer
905 views

How to transfer a Tracking Extract to Data Extension [closed]

The tracking extract generates a csv and has a lot more information than the respective data view. How do i export the tracking extract to a DE either with an activity or SSJS? Does anyone know if ...
user avatar
0 votes
1 answer
450 views

Can we identify Marketing cloud memberID using SSJS as we do in AMPscript?

Can we retrieve and identify Marketing cloud memberID as below using SSJS platform library as we do in AMPscript? IF memberid == 7765150 THEN SET @de = 'QA_DE' SET @url = 'https://pub....
Jay's user avatar
  • 11
0 votes
0 answers
289 views

What is the sequence of scripts execution in Marketing cloud ? ampscript executes first or SSJS?

What is the sequence of scripts execution in Marketing cloud ? ampscript executes first or SSJS ? or it will be top to bottom ?
Jay's user avatar
  • 11
0 votes
1 answer
134 views

Fetching and displaying titles, statements , image URLs etc. from data extension on Cloudpages using multiple html blocks

We are using multiple HTML blocks in a cloudpage (using new contentbuilder while creating cloudpage) and in each HTML block we are fetching titles , statements , image urls from Data extension ( one ...
Jay's user avatar
  • 11
0 votes
0 answers
220 views

Can't Access Child JSON Element of JSON Payload with SSJS

I've got this script up, I intentionally replaced some parts of the code with a series of Xs to censor any secure information. <script runat="server" type="text/javascript"> ...
Julie Nguyen's user avatar
1 vote
1 answer
669 views

Using Shared Content Blocks (Code Snippet - SSJS) and calling that Content Block inside an SSJS script

Here's my code, very stripped down to show the issue: <script type="javascript" runat="server"> Platform.Load("Core", "1.1.1"); try { Platform....
Mike Marks's user avatar
0 votes
1 answer
309 views

get image size properties with SSJS

What am i trying to do: I'm setting up a responsive e-mail template in Marketing Cloud using images from a datafeed. The image url's are successfully retrieved from the datafeed with AMPscript. ...
Tommy83's user avatar
1 vote
0 answers
219 views

Error from Rows.Add

I have the following script that returns the array as expected. When I go to add the "Rows.Add" aspect, I get a 500 error. I am testing the script on a cloudpage with plans to move it to an ...
Tariq McLeod's user avatar
1 vote
1 answer
412 views

Getting Interactions with WSProxy

I need to retrieve the info of the active journeys via API. I've been trying to get it with the Retrieve method of WSProxy but I cannot find the correct object for it. I've tried: Interaction, ...
Eduardo Ruiz de Pascual's user avatar
1 vote
1 answer
1k views

Find External Key of Data Extension from JourneyID [closed]

Can we find the External Key of Data Extension related to the Journey Builder using JourneyID? Is this possible to be done by SSJS or SQL?
Ben Inm's user avatar
  • 23
1 vote
0 answers
79 views

Count id in Data Extension and Upsert to another Data Extension using SSJS

This question might be a basic one but I am very new to SSJS so thank you for your understanding. The data extension names JourneyA, JourneyB, JourneyC...infinity are the result of Journey Builder. ...
Ben Inm's user avatar
  • 23

1
3 4
5
6 7
19