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

Can't print specific part of JSON using SSJS

I'm trying to retrieve a specific part (attribute Region) of JSON I receive and print it. Apparently, I'm missing something. I would really appreciate your advice. Platform.Load("core","1"); var ip ...
0
votes
0answers
24 views

Retrieve SFMC Data Extension Rows and Update 2nd Data Extension using SSJS

I have created two Data Extensions. I am attempting to use a Script Activity to update Data Extension B based on the contents of Data Extension A. I have attempted to do so with SSJS retrieve request, ...
0
votes
1answer
22 views

How can I retrieve a list of Data Extensions in a folder using SSJS

I would like to output a list of Data Extension names (and their customer keys) from a specific Data Extension subfolder. Is this possible using SSJS?
1
vote
1answer
24 views

Inserting Into Data Extension From External Key In Another Data Extension With SSJS Not Working

I am attempting to insert data into a DE, which I create from the FuelSDK, using a Script Activity, I created as part of an Automation, in Automation Studio. The script runs, but no data is inserted ...
1
vote
1answer
68 views

Using SSJS to randomise a string

I'm picking up salesforce marketing cloud and refreshing myself in AMPscript/SSJS. Could you give me some feedback on the following snippet? I don't have access to SFMC to test out, so I'm just ...
3
votes
1answer
41 views

Check IBAN validity function in SSJS

I found a piece of client side Javascript code to check the validity of an IBAN bank account number here: https://stackoverflow.com/questions/21928083/iban-validation-check Now I'd like to use this ...
0
votes
1answer
37 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
2answers
50 views

How to Add a subscriber to a list using ampscript or ssjs in SMS message

I need to add a subscriber to a list particularly the All Subscriber list, for cloudpagesUrl to work since it returns a broken link if the subscriber is not in the all subscriber list. I already ...
1
vote
1answer
60 views

Update Salesforce object through ampscript

I was trying to update account object through ampscript using UpdateSingleSalesforceObject this function,the result is returning zero value,is their any permission is need to be provided for accessing/...
0
votes
1answer
55 views

API call to external system to pull data to marketing cloud

Is it possible to make an API call from the marketing cloud to pull data from external system? One way to do it create a script activity and schedule it or calling the activity through API. Real ...
0
votes
1answer
19 views

Convert Reports values into numbers from strings in a script activity

I want to perform a script activity on an Account Send Summary report I dropped into a Data Extension. The current numbers inside of the system cannot be logically filtered because they contain "," ...
1
vote
1answer
77 views

Marketing cloud Contact deletion using ssjs

I am new to marketing cloud, can anyone tell me how to automate contactdeletion process using new OAuth 2.0. Using legacy the process works but not able to proceed with OAuth 2.0. <script runat="...
-9
votes
3answers
88 views

How to use trim() function in SSJS using data extension in Marketing Cloud [closed]

How do I use trim() functions in SSJS? Using Data Extensions. Can you please provide some examples? I have a Data Extension, where "Message" is an Attribute. In this Attribute how do I use the trim(...
0
votes
2answers
40 views

Unable to retrieve security descriptor for this frame error in HTTP POST request SSJS marketing cloud

I am trying to post a request to my site and I am using SSJS HTTP post method. But the POST request is throwing error "" Unable to retrieve security descriptor for this frame. Im not sure what i ...
3
votes
1answer
46 views

How Can I Programmatically Update Multiple non-sendable DEs to be Sendable?

I have a cleanup I'm working on and hitting a wall. We use email address as the subscriber key. I have a few hundred DEs with an "email" column that are NOT marked as sendable. I want to update them ...
1
vote
1answer
55 views

Using API call in SSJS

I would like to know if we can do an API call Using SSJS. My need is to extract data from a data extension and target an end point using API call. The SSJS is unfortunlly not documented very well. I ...
0
votes
1answer
50 views

SSJS and AMPscript

I'm trying to output message if there is an error and i have very little knowledge in javascript in general. Could I get some feedback on if the following would work or how I would go about : If ...
0
votes
0answers
55 views

The 'Content-Type' header must be modified using the appropriate property or method.\r\nParameter name

I am making a Http get request to 3rd party api using SSJS. each time i make a call is get below exception: e: {"message":"An error occurred when attempting to evaluate a Util.HttpRequest call. See ...
-4
votes
1answer
50 views

How to create a task for Salesforce cloud crm using ampscript [closed]

Please advise how to create a task for Salesforce object in MC using ampscript.please let me know is this functionality is achievable Regards Shiva
0
votes
1answer
72 views

How to insert csv file record inside data extension from cloud page?

I have created a cloud page where I have provided browse button and after selecting CSV file I am reading CSV file in the script so there are 100 contact records in csv and I am sending WhatsApp ...
1
vote
1answer
28 views

Status of adding data extension with SSJS

I am using Add() function to add a new data extension and I would like to access a status message if possible. I am using following code var deObj = { "CustomerKey" : "demoDE", "Name" ...
0
votes
1answer
28 views

ParseJSON Error for HTTPPost - SSJS Unable to retrieve security descriptor

In my marketing cloud, landing page. Getting the error "System.InvalidOperationException: Unable to retrieve security descriptor for this frame" while trying to Parse the JSON response in a HTTP Post ...
4
votes
1answer
70 views

Identify the Type of an Automation Activity using SSJS WSProxy

I'm trying to create an API call that will return the SQL Code from all Query Activities within an given Automation. Using the information provided in this question Retrieve multiple tasks in an ...
1
vote
1answer
68 views

Is it possible to create Script Activities through Marketing Cloud API?

I am developing an application to interact with our Marketing Cloud and I would like to be able to create custom Script Activities(containing SSJS API calls)through the API for each campaign so I can ...
-2
votes
1answer
48 views

ParseJSON array [closed]

I am trying to achieve the following. I have JSON with array: apicall = { "CallID":"123", "Response":[ { "Header1":value1, "Header2":value2, "Header3":value3 } ]} And I would like to parse the ...
0
votes
2answers
46 views

How to separate json response in different variables? [duplicate]

How do I separate this response in one variable, like I required from below response URL only in one variable? However, "BE050-A28" this value is dynamic in every response. { "vehicle": { "...
1
vote
0answers
50 views

Correctly parse JSON

I am trying to make a call to external API but I don't know how to correctly parse results. Here is the format of the response. I can correctly parse the Status, but Results is an array and nothing so ...
0
votes
1answer
81 views

How can I add data to Dataextension for SSJS

I am trying to add data to Data Extension using SSJS Script through Automation Studio. 1.I want to HTTP GET(ThirdParty's recomend) 2.I want to catch response(JSON) and add data to Dataextension How ...
2
votes
1answer
50 views

SSJS equivalent of DecryptSymmetric

Knowing that we have EncryptSymmetric and DecryptSymmetric in Ampscript, both with the ability of referencing password, vector and salt, from Key Management - is there anything similar in SSJS? If a ...
-1
votes
1answer
41 views

How to remove a record from a publication list using scripting [closed]

Can please help me to how to remove a particular record from publication using scripting(ssjs/api ampscript) Thanks, Shiva
1
vote
1answer
70 views

SSJS Script not Looping Through

I have some code which doesn't seem to loop through the i variable incrementally... any ideas where I'm going wrong? <script runat="server"> Platform.Load("core","1.1"); var DE1 = ...
2
votes
1answer
49 views

How to obtain error status of automation via SSJS

I have the below SSJS which gives the status of scheduling in automation. But it doesn't give the status of automation: For example, if my automation errored, then am getting the status '6' which is ...
0
votes
1answer
31 views

Update SQL Query Text via SSJS

I have written some simple code which i will try to loop later but I am getting no success in trying to use SSJS to update SQL queries. I don't need to perform the actual query i just need to update ...
0
votes
0answers
22 views

Using SSJS WSProxy within Postman to directly make SOAP API calls without needing the Soap XML request body

So far I've been able to use Postman to pass values to a SFMC Landing Page or CloudPage that hosts SSJS WSProxy to execute a particular SOAP API requests such as updating a data extension that occurs ...
2
votes
1answer
30 views

Not able to access token from response object via dot notation SSJS

I am not able to access the token via dot notation (from response object) - what am I missing here? Platform.Load("core", "1"); function requestToken() { var url = 'some_url'; var ...
1
vote
0answers
60 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 ...
0
votes
1answer
31 views

SSJS Restrict Contact

Is there any SSJS function that would allow me to restrict a contact? (I can't find anything related in the documentation) Ref: /contacts/v1/contacts/actions/restrict?type=keys
0
votes
1answer
34 views

Error executing HTTP.Post call from Microsite landing page

Here's my code below. The error happens at the first HTTP.Post call. The error message is simply: ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a ...
0
votes
0answers
26 views

How to add content to above email template assigned to Triggered Email

I have managed to initiate the Triggered Email using AmpScript in a Cloud page. Is there a way to pass in text content into the Triggered Send above the email assigned to the Triggered Email ...
0
votes
1answer
56 views

SSJS to save data into a data extension

I am really new to SSJS but what I am trying to achieve is to pass some parameters in the URL from an email and capture them in the cloud page and then save that data into a DE using SSJS. At the ...
1
vote
1answer
45 views

Displaying the publication list so the user can opt-in from a cloud page

I want to create a cloud page where it displays all the publication lists and from those user can select and subscribe in any of the publications.Just like in the subscription center. As I am new to ...
1
vote
1answer
83 views

SSJS HTTP Get method error - Unable to retrieve security descriptor for this frame

I am trying to retrieve a template-based email asset using the Content Builder API via a Cloud page. I am having trouble retrieving the template. I am not sure if it is an issue with the structure of ...
0
votes
0answers
29 views

SSJS to bulk update SQL Activities

I have many SQL Query activities each of which i need to update the query text to a) join a data extension b) add to existing where clauses to exclude the joined DE where the unique field IS NOT NULL. ...
1
vote
1answer
48 views

Automation doesn't run through SSJS when it is in a Paused state

I was able to run an automation which is in "scheduled" staus using SSJS, but when I pause it manually (status changed to "Paused") and execute the same script, the automation doesn't run. The script ...
4
votes
2answers
136 views

Deleting a Mobile Connect instance of a contact only (without deleting the entire contact)

The current deletion framework that was added last year does deletes entire contacts. A contact deleted this way is deleted from: All Contacts All Subscribers Mobile Connect I have a problem where ...
0
votes
0answers
54 views

Issue in retrieving response body for 4xx and 5xx response code via HTTPPOST2

I am calling third party API via HTTPPOST2 using ampscript, and need response body for response codes like 4xx or 5xx. For success scenario, I am getting the response body in response parameter of ...
1
vote
2answers
93 views

Trigger ImportDefinition through WSProxy

I made a script (SSJS) to create a new Import Definition in Marketing Cloud. That works well, and if I then trigger the import manually in the GUI the import successfully completes. However, I also ...
1
vote
1answer
38 views

HTTP.Get - Need a solution for Non english xml data

I am using Server side javascript 'HTTP.Get' to retrieve Meta editor XML data. I could successfully retrieve for English documents into Salesforce Marketing Cloud. But It doesn't work for Chinese ...
0
votes
1answer
67 views

Retrieving specific Email object using SSJS

I am trying to retrieve a specific email send that has gone out previously. I have been using the RetrieveRequest object in SSJS to attempt to access the "Email" object. It has been able to retrieve ...
0
votes
1answer
28 views

Can't create Data Extension with SSJS

I'm trying to create a proof of concept data extension with one field for each unique value in a specific column of another data extension. I am intending to do this using a SSJS script run as part of ...