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
0answers
120 views

SSJS Data extension creation error

I was trying to create a data extension based on the value that i get from the sync de. Could anyone tel me what exactly the issue is, in my code. When i try to run this in the automation studio ...
0
votes
1answer
350 views

AMPScript for loop and SSJS

As the subject says, I would like to use two line of SSJS code in a for loop like in the example: VAR @listAddress, @nameChosen, @Counter, @i, @AddressRow, SET @listAddress = ...
4
votes
1answer
147 views

How to translate the cloud pages based on the browser language in salesforce marketing cloud

I have been working in custom preference centre and one of the requirement is to translate the page based on the browser language. The difficulty here is detecting the browser language "Navigator....
0
votes
1answer
132 views

Storing JSON reply payload object in Data Extension

I'm successfully getting a result from an HTTP.Post call. My reply comes in a form of a JSON and looks something like this: { "Result": { "Message": "", "MessageDetails": "", "Status": 1 ...
1
vote
1answer
43 views

Marketing cloud - SSJS - Truncate Sendable DE

I have a sendable DE which i am trying to truncate . however its erroring out. The code for ssjs is <script runat="server"> Platform.Load("core", "1.1.1"); var rows = Platform....
9
votes
1answer
224 views

Handing REST API POST Exceptions using SSJS Try-Catch on a Landing Page Form Submission with AMPSCRIPT

I have an issue with a landing page containing a webform that submits input from the user and using AMPSCRIPT I make a Rest API call using the HTTPPost2 function to utilize the validateEmail resource. ...
0
votes
1answer
213 views

SSJS Rows.Lookup with multiple criteria

I want to perform lookup search with multiple criteria applied. The below code works with one condition, but I have not found the solution to add conditions. Are there any solutions for that beyond ...
0
votes
1answer
209 views

Get and format system time with SSJS [duplicate]

How do I get current Marketing Cloud system time, usng SSJS on a cloud page. This is the format I need: 11/8/2018 14:16:54 Ideas?
1
vote
1answer
98 views

Fetching more than 2500 records returning null for everything but correct amount of records

So I am attempting to write code that returns more than 2500 records so that I can use the data for display on the page (I know this will be slow but it is business' requirement). There are currently ...
5
votes
1answer
219 views

Error adding EmailSendDefinition using SSJS

Using the documentation in the SF Help docs I am trying to create send an email to a specific person using the following code: <script type="text/javascript" runat="server"> try { ...
0
votes
2answers
42 views

Improve update query SSJS block to report errors

I've just managed to make a landing page where you can enter the target data extension, update type, and query definition of a query you want to run, press submit, and run it. It uses the following ...
1
vote
1answer
115 views

Get value of URL hash using SSJS in Marketing Cloud

Is there a way to return the full URL -- including any hash values using Server-Side JavaScript in a Landing/Cloud Page in Marketing Cloud ? If the incoming URL to my page is: https://pages.email-...
3
votes
1answer
117 views

What's the different between the core versions in SSJS?

I wrote a number of SSJS before, but a question that just can't sort it out: the core version. From the official document: it said: Given that the Core library has 1, 1.1, 1.2 and 2.0 versions, ...
3
votes
1answer
313 views

Using SSJS to send single email in Marketing Cloud

Is it possible to send a single email to a Subscriber rather than a whole List using the SSJS Send Mail function? My code is as follows, you can see we have to provide a List ID to send to. <...
1
vote
0answers
254 views

What's wrong with this “HTTP.Get” in SSJS?

In activities I am running this script: <script runat="server"> Platform.Load("Core", "1.1.1") var NewReq = HTTP.Get("http://samplesite.com/sample.html"); </script> It always throws ...
0
votes
0answers
30 views

Email Preview using REST API [duplicate]

I have written a SSJS code to preview the rendered email. <script runat="server"> Platform.Load("core", "1"); var url = 'https://auth.exacttargetapis.com/v1/requestToken'; ...
1
vote
2answers
140 views

SSJS Error - Retrieving data from two DataExtensions and want to update the initial DataExtension

Anybody an idea what is wrong with this script? It is my first SSJS script in the automation studio but I just get the error message: An error has occured. I got the functions from the documentary. ...
2
votes
0answers
203 views

Getting Error while trying to trigger API event in Journey From Landing pages using ssjs?

I'm working creating a trigger API event in Journey builder from landing pages. I am currently able to get the accessToken using clientId & clientSecret, but then I tried to pass subscriberkey &...
0
votes
1answer
225 views

SSJS : Parsing URL from JSON

I have a CloudPage form which contains a Select Dropdown with a JSON-esque Value: <select id="Select_Specialism" name="Select_Specialism" required=""><option value="">Select Specialism<...
0
votes
1answer
101 views

Get ListID of a Subscriber's Publication List programatically?

Is it possible to get subscriber's ListID of a Publication List? A retrieve from _Unsubscribes gives me only AllSubscribers listID. I've tried every API from MC, I can't get that ListID. set @rows =...
0
votes
1answer
61 views

Best practice - Really complex email - use TreatAsContent()?

I am working on an email that is very very complex with tons of ampscript and SSJS covering for a lot of different scenarios. The amount of code is still increasing as we go and it holds calls to both ...
0
votes
1answer
103 views

Retreive all records which contain a certain value (Cloudpage, Ampscript and SSJS)

I want to show jobs which are stored in a data extension in Marketing Cloud on a Cloudpage. I got that working, but it only shows the EXACT value. For instance a if i put in a value "Able Seaman" will ...
0
votes
2answers
53 views

get email recipient's first and last name in Cloud Page with SSJS

I'm using CloudpagesURL(xxxx) in an email to link to a SFMC Cloud Page when the CTA is clicked. How can I get the first and last name of the email recipient in the cloudpage with SSJS? Do I have to ...
0
votes
1answer
256 views

Get Name of Data Extension with Ampscript or SSJS

I'm using a landing page with some SSJS to create several shortcut utilities for Marketing Cloud - namely copying data extensions and running single-use queries without having to save them. I've got a ...
0
votes
0answers
33 views

Digest Auth with AMPscript or SSJS

I currently try to retrieve some data from a webservice via AMPscript. I've already done that on other projects through the following AMPscrpt, which works perfectly. SET @webservice = HTTPPost2("www....
0
votes
0answers
113 views

Content Builder: Automated Image creation from URL

I want to establish an automated image creation that pulls images from URLs to content builder and automatically saves or overrides them, because i want to use these images in emails and i believe ...
0
votes
1answer
184 views

Read and manipulate Data Extension rows with JS in CloudPages

I am trying to retrieve around 2,500 rows from my Data Extension into a CloudPage so I can use it for some dynamic forms using JS. I would like to know what would be the best way to retrieve this ...
0
votes
1answer
284 views

How to load a JS library onto server in Marketing Cloud?

I want to load this CryptoJS library onto the server so I can perform encryption server side. Is it possible to achieve this? I even went as far as simply copying and pasting it all like below, but ...
2
votes
1answer
175 views

Is it possible to perform HMAC SHA1 encoding with Ampscript?

Is it possible to do this with Ampscript? Is it possible to achieve this with SSJS? I understand there is an apex function that can do this, but I am not sure it is possible to use apex with ...
1
vote
1answer
158 views

Deleting records in sales cloud using REST api

I am trying to delete multiple records using REST Api. var contentType = 'application/json; charset=utf-8'; var headerNames = ["Authorization"]; var headerValues = [("Bearer "+sessionId)];...
1
vote
1answer
105 views

how to get the textbox value entered and call the function on keypress in ssjs

I am trying this in SSJS. I have a textbox. What I need is when the user enters any data in the textbox I need to take that value, search in the DE and display a list of matching data. So how can I ...
2
votes
1answer
497 views

Ampscript or SSJS method to copy data extension

Is there a way to copy a data extension, either using ampscript or SSJS, to create a new data extension? Some of our work involves duplicating several data extensions with similar schema and it would ...
1
vote
1answer
50 views

Get a value from Array output

Using the below property I'm able to get Subscriber Properties. var results = Subscriber.Retrieve({Property:"SubscriberKey",SimpleOperator:"equals",Value:Sk}); The results output is an array. How ...
2
votes
1answer
178 views

Trigger Email Send from within an Email (AMPScript or SSJS)

Does anyone know if it is possible to Trigger an email, using AMPScript or SSJS, from within an email ? My use case is this : I have an email, which contains a complex amount of AMPScript and has a ...
0
votes
0answers
50 views

It is possible to pass the value to profile attributes using ssjs script

It is possible to pass the value to profile attributes using ssjs script this is my code <script runat=server> Platform.Load("Core","1"); var ts =Send.Definition.Init('Error_Email_for_Sage'); ...
1
vote
1answer
345 views

How to improve this SSJS

Recently started to learn SSJS and wrote the script (for automation studio) which is located below. What i am interested in is: How can i improve this Server Side JavaScript performance wise? For ...
2
votes
0answers
268 views

How to setup SSJS to create data extension from existing template?

My audience data extension has hidden data types, such as LongNumber and Decimal (set to more than 18 digits for example 20.15), these are fields that were appended from the audience attributes. Via ...
1
vote
0answers
42 views

Passing a PartnerProperties parameter when starting a FileTransferActivity object via SSJS

Within the Salesforce Marketing Cloud, I am attempting to run a series of Data Extract & File Transfer activities sequentially, all with a different filename (ex myFile_2018-01-01.csv, myFile_2018-...
0
votes
1answer
183 views

How to Create / Update Query using WSProxy method?

I am trying to create / Update Query Definition using SSJS WSProxy method. This is my script: <script runat="server" > Platform.Load("core","1.1"); var api=new Script.Util.WSProxy(); ...
1
vote
1answer
96 views

Using Journey Context data in email

Is there any way to retrieve a Journey's context data (definitionInstanceId, journeyId) using AMPscript, GTL or SSJS in an email ?
0
votes
1answer
69 views

Category ID Shows 0 for Query Definition Retrieve

I am trying to Retrieve the Query Definition's Folder ID using SSJS but every time it shows 0 for CategoryID for the Query Definition. My simple SSJS as follows: <script runat="server"> ...
2
votes
2answers
420 views

Overwrite Data Extension with API call

Has anyone figured out a way to overwrite Data Extension rows via API call? There isn't anything for it in documentation, neither SOAP API, SSJS, AMPscript, WSProxy or GTL seem to have an option to ...
1
vote
1answer
134 views

Type of html emails in the system regarding API

We are creating HTML Emails and I want to get the content of them by SSJS but the problem is their type is not "Email" or "ContentBlock", it is like in the middle of those. I can retrieve their IDs, ...
0
votes
1answer
167 views

Problem in updating DE using SSJS

We are trying to fetch Promo Code for each customer and updating the issued promo code status to true in DE. While updating we noticed the update row count is -1, still the DE is getting updated. ...
0
votes
2answers
375 views

Retrieving Emails using SSJS

I need to duplicate an HTML Email with SSJS but in order to do that, firstly, I should get the content of the Email I want. I have written the code below but it doesn't work. The strange thing is the ...
1
vote
1answer
691 views

Trying to InsertData or UpsertData using SSJS and I getting error message “Unable to retrieve security descriptor for this frame.”

I'm working on a custom Subscription Management page using CloudPages, and I'm able to update existing subscriptions in the target data extension using SSJS just fine: var updateResults = Platform....
0
votes
1answer
277 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
1answer
235 views

Add Subscriber to Auto Suppression Lists with SOAP API

I am trying to add a Subscriber to an Auto suppression list using SOAP API. Here is the envelope I am using : <?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="http://www.w3.org/...
0
votes
1answer
153 views

How do I sort a rowset with Server Side Javascript linked with AmpScript?

I'm using AmpScript to make a custom email and I need to sort rows to display them in order of date. I saw that I can use Server Side Javascript to make this, but my variable in ampscript is a rowset, ...
0
votes
1answer
169 views

How to create content Block in content Builder through ssjs in marketing cloud

I am trying to create content block in content builder using ssjs code but I am getting error, please check below code and how to resolve the issue? <script runat="server"> Platform....