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

Rendering different images based on OS (iOS/Android)

I am trying to implement the functionality of rendering different image based on the device's OS it is getting rendered on for eg: iOS, Android. I have written the below SSJS code in my Freeform block ...
0
votes
2answers
76 views

Retrieving Automation Instance Object

I am trying to retrieve status of automation instance object to see status of the last 4(in last 24 hours- since the automation runs in every 6 hours) instances of the automation. I am using the below ...
1
vote
1answer
197 views

Can I save SSJS Variables in the Client?

I was wondering if I can save data from an SSJS function in the client to use in JS scripts that run on the client-side after page load. For example, get value from ampscript, then set that value as a ...
0
votes
1answer
264 views

SSJS perform data extract

Running this script but getting the error : - {"message":"Error executing perform call.","description":"ExactTarget.OMM.FunctionExecutionException: Error executing ...
1
vote
1answer
219 views

WSProxy to retrieve all data extension across all business units

I have the following SSJS function which uses WSProxy to return an array of all data extensions across all business units, however, when I test the script in a CloudPage (in a child BU), it returns ...
0
votes
0answers
70 views

Using WSProxy to lookup rows returns “Error: Data extension does not exist:”

i'm using SSJS/WSProxy so that i can search data extension for a specific email address and return the DE name + any rows that contain that email. I have the following FOR loop that takes each Email ...
1
vote
5answers
298 views

SSJS Platform.Response.Redirect() throws unknown error: Error in Application

I am trying to understand why the following is happening: <script runat="server"> try{ Platform.Response.Redirect('http://www.google.com'); } catch(e) { ...
0
votes
2answers
1k views

How to display Date (Format 'DD/MM/YYYY') in a single input type textbox in cloudpage

I'm trying to display a Date in a single input type textbox in Cloudpage, the data will be coming from Data Extension. I tried changing the type to date : <input type="date" name="...
0
votes
2answers
300 views

how to update status active or Unsubcribed of subscriber in _ListSubscribers

I'm trying to do it this way, but I'm getting 500 error %%[ var @SubscriberKey, @ListID, @ListType set @SubscriberKey = "example" set @ListID= 123 SET @ListType= "Publication List&...
0
votes
2answers
97 views

Cloud Pages - API request inside of an IF statement

I'm using the following code in a Cloud Page to submit an HTTP Post request. I was able to get the Script.Util.HttpRequest() methods to work on their own. But now I want to only submit the request if ...
0
votes
1answer
213 views

Populate data extension with SH-256 encrypted email addresses

I have a project where I need to deliver hashed email addresses to a vendor for the purposes of data matching. The vendor accepts SHA-256 hashed emails. Is there a way to populate a data extension ...
2
votes
1answer
2k views

encrypt email address in a data extension

I'd like to encrypt email address in a data extension with SHA256 within marketing cloud. This will be used as a unique identifier. When the email goes into a data extension, have the email address ...
0
votes
1answer
47 views

DataExtension.Retrieve() returns undefined

I'm trying to get this variable in my cloudPage ("allDataExtensions") to return an array of all data extension objects in my org. The original formula I was using was as follows Original ...
0
votes
2answers
371 views

Automate Data Extension Deletion in Salesforce marketing cloud [closed]

We have multiple Data extension which are no longer required for use. I want to delete all the data extension inside a folder in SFMC. is there any way to achieve this using automation or SSJS? I don'...
0
votes
0answers
50 views

POST Request via SSJS - Authorisation Types

I am working on sending an outbound POST request and haven't been able to send one to my end point url. I'm receiving a Status Code 500 indicating that this is an SSJS issue however, upon closer ...
0
votes
1answer
23 views

Use subscriber attributes in automation studio with SSJS

I want to save the subscriber from a DE in a new DE, who have birthday today. The birth date ist not saved in in the DE, so I want to use it from the profile center. var newsletterDE = DataExtension....
0
votes
1answer
4k views

Date manipulation Function SSJS

I want to delete the records from Data Extension based on Date Field in my DE i.e. I want to delete record which were created date before 30 days.But I didn't find date manipulation function in SSJS ...
0
votes
1answer
170 views

Reference SSJS Code Resource in your Landing Page

I've been trying to insert/reference an SSJS code resource in my landing page but using the CloudPagesURL(123) function doesn't seem to work? I've been using the function when referencing javascript ...
0
votes
0answers
37 views

fetching Dataextension headers using Soap+ssjs

I get no error, my cloud page keeps running <script runat= "server"> Platform.Load("core", "1.1.1"); var username = 'abc'; var password = 'xyz'; var ...
0
votes
1answer
62 views

Is it possible to execute ampscript or ssjs onchange via checkbox check/uncheck

As I wrote in the question title I was just wondering if a block of ampscript & ssjs combined code can be execute on change via checkbox check/uncheck? <input name="TopicID" type=&...
0
votes
1answer
139 views

How can I check my JSON object contains a string?

I am using SSJS to check if the variable event in my JSON object contains a string but am struggling to get it working. Here is my code var jsonpost = Platform.Request.GetPostData(); var payload = ...
0
votes
2answers
73 views

Ampscript SSJS Error Internal Server Error

I created a ampscript to embedded into cloud page to update the object in Salesforce. Here is my Cloudpage landingpage: <!doctype html> <script language="javascript" runat="...
0
votes
0answers
444 views

Salesforce Marketing Cloud - Making REST API Call to send data from marketing cloud to External

I have coupon details in marketing cloud . Once email is sent out of Marketing cloud via journey,i need to send email sent date to external . Post journey acitivty i'm planning to trigger ssjs ...
1
vote
1answer
111 views

Read all request headers on CloudPage server side without knowing their names

I need to store whole HTTP request made to a CloudPage for audit purposes. I'm able to log everything besides headers. I'm unable to read all of them with ampscript or SSJS without knowing their names ...
0
votes
0answers
179 views

Fetch failed loading: POST

I am building a form on a Landing page, and I keep running into an error when I'm passing the javascript to the processing page. In the error console, I see the following: Fetch failed loading: POST &...
0
votes
1answer
76 views

AccountUser in SSJS not fetching any data

I've issue with retrieving 'AccountUser' object via SSJS. I've created a cloud page in a BU to which I've access to and my account is an 'API user' account - so, I figured I should get a response. My ...
0
votes
0answers
41 views

How to add offset value to REST API URL

I am trying to filter history for a activity using journey history search REST API URL. Along with page and pageSize is there any way to provide the offset value in the URL or to pass offset in the ...
0
votes
0answers
113 views

How to handle 'Bad Request' on Landing Page

I am running few SQL queries on Landing Page using SSJS, but unfortunately having 'Bad Request' (perhaps time out) most of the times. Please suggest the way forward. Scenario: After Query.Perform() on ...
0
votes
1answer
65 views

Is there a simple way to alphabetically order incoming string value separated by a comma using Ampscript in SFMC?

%%[ <br><br> VAR @segmentProduct, @queryparams SET @segmentProduct = AttributeValue("SEGMENT_ENTITLEMENTS") SET @queryparams = BuildRowSETFromString(@segmentProduct,',') ...
0
votes
0answers
21 views

Trying to retrieve status of Automation in a particular folder

I am trying to retrieve status of all Automations in a particular folder in my instance. I am using the below code. However, I can see in the output that the category id is null. I am expecting a ...
0
votes
0answers
53 views

Marketing cloud row deletion results in error

Code: <script runat="server"> Platform.Load("core","1.1"); var SOURCE_DE = "xxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" var CUSTOMERS_DE = "vvv-vvvv-vvvv-vvvv-vvvvvvvvvvv" var DELETE_CUSTOMER_LIST = new ...
0
votes
1answer
95 views

Havving issues updating fields in Data Extension with SSJS

In Marketing Cloud -> Automation Studio -> Script Activity, I am trying to run a script that updates a column named "age" (dtype: integer) based on another column named "date of birth" (dtype: date). ...
0
votes
2answers
140 views

How to trim a particular word from a string and store it? [closed]

I am storing the URL given below in a field in DE: https://www.tbd.com/tbd-bags/?utm_source=sfmc&utm_medium=email&utm_campaign=_4in1tbd_20170421&utm_term=nav4+bags&utm_id=9087&...
0
votes
1answer
60 views

Schedule Automation using script activity

I have a case where I built a file drop automation that contains an import followed by a script activity. Inside this file I'll be uploading a date. If the date matches current date, I want one ...
0
votes
1answer
42 views

How to dynamically change the start time in the query body of REST API

I am doing a REST API call using POST method with [SSJS]. In the body of the API i am sending the following parameters. var start= { "activityTypes": [ "Wait" ], "start": "2020-...
0
votes
1answer
429 views

How to convert date to yyyy-mm-dd format using ssjs without timestamp

I am trying to convert the date to YYYY-MM-DD format using SSJS. But not able to do that. Getting NAN. var day = new Date(); var prevDate = new Date(); yesDate.setDate(day.getDate()-1); var test = (...
0
votes
1answer
152 views

Parsing JSON in email using SSJS and Ampscript

This is my JSON request : { "definitionKey": "SSJSTEST19", "recipient": { "contactKey": "007", "to": "sourabxxxxx", "attributes": { "EmailAddress": "sourabxxxxx", "...
1
vote
1answer
756 views

Adding users in a list in Exact target Marketting cloud

I am trying to add a subscriber to a custom list in my child account in a landing page using SSJS. I have followed the examples given in the Exact target support document and I could able to update a ...
0
votes
1answer
211 views

How to increase Pagesize of REST API call response using SSJS in Cloudpage

I am using REST API call to get history data. For this I am writing SSJS in Cloud page and am trying to store the data in a data extension. The result of REST API call is more than 100 records. But by ...
0
votes
2answers
251 views

How to get all the records from rest api response [duplicate]

I am trying to get all the records(800000) updated in to a data extension but it is allowing me to get 10000 records at a time. I am using POST API call, SSJS in my cloud pages to update in a data ...
0
votes
2answers
2k 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
2answers
568 views

parsing JSON in cloud pages using ssjs

I am trying to parse a JSON which I get after doing a post call in the cloud page, The returned JSON is nested and I can't access it, I have tried the GLT but it is not working. This is my JSON : { ...
0
votes
1answer
71 views

How to create a SQL query using CloudPage input?

I have a simple CloudPage using the Smart capture form. The form collects a number and writes that number into a column called 'input_number' in a data extension. Is it possible to fetch the '...
0
votes
1answer
125 views

can we generate hmac in SSJS Marketing cloud

I am trying to find SSJS function in marketing cloud. is there any way to generate hmac sha256 in server side javascript in marketing cloud ? does SSJS has any equivalent to CryptoJS.HmacSHA256(, ) ? ...
0
votes
2answers
845 views

Getting Error while try to get Salesforce OAuth access token from SFMC cloudpages ssjs httppost?

Actually I try to get access token of salesforce DC from salesforce MC by SSJS Httppost I need to create a record in salesforce object From Salesforce marketing cloud pages <!doctype html> &...
2
votes
1answer
175 views

Generating Salesforce OAuth2 token via SSJS returning empty response

I am trying to generate OAuth2 SF token via SSJS code on a CloudPage. I am not sure why I receive an empty response here. Following is my code <script runat="server"> Platform.Load("core","1");...
0
votes
3answers
685 views

Clearing a Data Extension using SSJS with SOAP

I am using the below SSJS to clear out a data extension. It works well in the Parent BU but when I run it in a Child Business Unit it fails <script language="javascript" runat="server"> ...
0
votes
2answers
63 views

How can I reactivate users that have been unsubscribed using LogUnsubEvent() in the same script?

I'm attempting to use the LogUnsubEvent() to mark the user as unsubscribed in the tracking job, but don't want the user to actually be unsubscribed from the All Subscribers.I'm sending from a Sendable ...
1
vote
0answers
46 views

Import file name into DE as field value

Do you know if it is possible to 'read' a file name from a triggered automation/import activity and then use the string in the filename to populate a field in a DE in which the records from that file ...
0
votes
2answers
183 views

how to parse xml to json via SSJS

I'm using SSJS to send an API request, the API response is an XML format. For example: <Result> <status>0</status> . . . </Result> How can I get the status ...

1 2 3
4
5
14