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
68 views

Marketing Cloud SSJS - does not write to DE

I have a SSJS to be used in rest api calls. It will be an scheduled call thus this is an script activity. The script automation returns a success but I do not see any changes, it should write to DE if ...
0
votes
3answers
108 views

Can we capture start and End time of an activity in automation through SSJS or SQL query in SFMC

We are currently updating our account data extension once everyday using automation studio, I was checking whether we can capture the start time and end time of the activities in automation and the ...
1
vote
2answers
251 views

Trying to trigger an automation from different Business unit using SSJS Activity

I have written the below code and created one test scheduled automation to start the automation. I didn't get any error when i did scheduled/publish the code but my automation is not starting. and i ...
0
votes
2answers
86 views

Automation change to Paused after every run

I have implemented couple of Automations which are calling each other using SSJS script. After every run of the Automations these are going back to "paused" state. This causes future executions thru ...
1
vote
1answer
109 views

Fill a DE thanks to SSJS in Script Activity using an external API

What I'm trying to do, is to fill a Data Extension using SSJS on weather column. (For the test I'm using nodeJS) Data Extension : "Weather API" weather | city name | country code (empty)...
0
votes
3answers
217 views

Assigning SSJS variable to AMPscript in a Loop

I have a requirement, I need to get all the data extension fields dynamically based on DE customer key and need to pass those fields into AMPscript to execute other functions. Below is my SSJS code: &...
0
votes
0answers
28 views

Does WSProxy support scheduling?

It doesn't seem to support the "schedule" action, and whenever I try to setup scheduling using the update verb, it processes it with no error, but no changes are recognized.
-1
votes
1answer
62 views

How to show alert in server side javascript on conditional basis?

I am using server side Javascript and fetching a column from data extension. I want to show alert on the basis of value retrieved from SSJS lookup but whenever i place alert in SSJS code i get 500 ...
3
votes
1answer
358 views

SFMC SSJS error handling - try catch

I have the following code: <script runat="server"> Platform.Load("Core","1.1.1"); try{ var logDE = DataExtension.Init("testDE"); throw "this is an error"; logDE.Rows.Add({"c1":"...
1
vote
0answers
106 views

SSJS script activity not updating Query Definition as expected

I am trying to update a query definition in Marketing cloud using SSJS script which updates the query based on the datestamp. When I run the script, I don't get any error but it does not seem to be ...
1
vote
1answer
357 views

How to access client side javascript variable in SSJS?

I am facing difficulties in showing a message. Below is the problem statement : I have six textboxes on a cloud page which stores six digit coupon code(one digit each). I am trying to show a error ...
0
votes
0answers
26 views

Unable to Create Folder under Shared Data Extension from Parent BU through SSJS Script

I am trying to create a folder dynamically under "Shared Data Extensions" in Parent Business Unit using SSJS script. But it is throwing "Error adding folder." . Do we need to enable any special ...
4
votes
1answer
163 views

Using AMPscript/SSJS to unsubscribe from a parent business unit on a CloudPage from a child business unit?

If you click 'Unsubscribe from All' on the Subscriber in the Subscriber Properties modal in the parent business unit's context or when you perform an SSJS subscriber.Unsubscribe(); on a CloudPage on ...
0
votes
2answers
188 views

Help With Access Token for Server-to-Server Integrations Using SSJS

I am using the script below <script runat="server"> Platform.Load("core","1.1.1"); var client_id = Variable.GetValue("@ci"); var client_secret = Variable.GetValue("@...
2
votes
1answer
129 views

SSJS Error retrieving the automation activities of an automation

I'm trying to use SSJS to retrieve the automation activities of an automation, using this code: var api = new Script.Util.WSProxy(); var cols = ['Name', 'CustomerKey', 'AutomationTasks']; var ...
1
vote
1answer
125 views

SSJS Post request error

I'm trying to delete contacts based on DE. So far I'm testing the code on cloud page but eventually, it will be used as part of automation. I'm successfully retrieving a token but struggle to execute ...
9
votes
1answer
271 views

Using AMPscript/SSJS how do you unsubscribe a subscriber from a child business unit?

My goal is to create a page that passes a business unit id and a subscriber key. The page sits on the parent/enterprise business unit, it will receive business unit ids from a child business unit. ...
1
vote
0answers
211 views

SSJS - Read a Data Extension after an Rows.Update

i'm now in my firsts baby steps in JavaScript on Salesforce Marketing Cloud. In my script i read one Data Extension with an DataExtension.Init("DE") and a DE.Rows.Retrieve(filter). After this, some ...
0
votes
2answers
65 views

Removing specific records from DE using SSJS script

I have a data extension that holds customer vouchers. I have different types of vouchers in that DE: WEL (welcome), BDY (Birthday) Because Birthday is a reoccurring event, i reissue Birthday ...
1
vote
1answer
177 views

How can I read a cookie via SSJS?

Is there a way to read cookie values via SSJS? setting works via Platform.Response.SetCookie(...);
1
vote
1answer
187 views

Create Filter Definition via WSProxy

I have hit a bit of a wall in this. I can create Filter Definitions via the SSJS function and via SSJS and AMPscript and SOAP API calls, but every time I try to create via WSProxy, I get the same ...
1
vote
1answer
147 views

Unable to retrieve email with WS Proxy and Email Retrieve Request

I am facing something that I can't understand. I try to retrieve all existing emails by using the WS Proxy utils but I always have an empty response. {"Status":"OK","RequestID":"cc1da13a-cee1-4aa6-...
1
vote
1answer
170 views

Marketing Cloud - Just trying to get record count of a Data Extension in SSJS

I followed part of the solution posted by @Gortonington here: How to improve this SSJS, but the following code does not reach the end of the DataExtension and unless I break, moreData always reads ...
1
vote
1answer
195 views

Getting an array column through WSProxy.retrieve

I'm using WSProxy to retrieve information about an Automation. This works fine, until I want to retrieve a column that is an array. To be exact, I would like to get the AutomationTasks for a certain ...
1
vote
0answers
237 views

Accessing contents of a file while trying to read uploaded file

I am trying to load and read a CSV file, but I want to iterate through the lines of a file in APEX rather that JS. The reason is that we expect the CSV files to be large and want to handle that job on ...
3
votes
2answers
148 views

Is there a way to identify all the places a Content Block is used?

I'm trying to identify all the places a Content Block is used. The goal is to be able to reference what will be affected if a Content Block is modified. I've looked a the Asset in the REST API, but I ...
3
votes
1answer
225 views

How to reference client-side input from a cloud page in SSJS

I have two microsite cloud pages: (1) to ask a user for the information, and (2) one that takes the information and uses it in a SSJS WSProxy call The first page captures information like: <form ...
2
votes
1answer
130 views

SSJS Create Data Extension with Retention

I'm using following SSJS script to create a Data Extension and set the retention of 7 days at row level: Platform.Load("core", "1.1"); var deObj = { "CustomerKey": "my_DE", "Name": "my DE", ...
0
votes
2answers
511 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="...
1
vote
2answers
211 views

JSON call using SSJS to populate a dropdown list in HTML and pass it through using AMP

I have a JSON object full of County names and I want to call it using SSJS then populate a dropdown list in HTML using the Data from the JSON. JSON looks like this [ "AZ - Maricopa", "AZ - ...
2
votes
2answers
446 views

SSJS Rows.Update function not working with variable in FOR loop

I am trying to loop through all rows of a data extension and update the name of each record. I created an SSJS script activity to run the below code and it is not erroring out, but it is not updating ...
2
votes
1answer
105 views

Saving Server Side JavaScript Functions

Is it possible to create SSJS functions as code resources in Web Studio and then use those functions in other CloudPages or Script Activities? For example, if I created a function that generates an ...
1
vote
0answers
160 views

Insert a delay of a few seconds in SSJS script after a function call

Use case: Send emails based on personlization data of a few records using SSJS script. I have an email that will pull personlization data of off a non sendable Data Extension. The email will pull the ...
1
vote
3answers
233 views

Changing Unsubscribe reason through SSJS

I noticed that you can unsubscribe a user through SSJS, is it possible to use SSJS to change the unsubscribe reason? I notice that doing it through the API seems to be popular? why is that? Thanks
0
votes
1answer
174 views

SystemDateToLocalDate inside SQL Automation

I know the function SystemDateToLocalDate is not available inside SQL but i would like exactly that feature inside an SQL query to convert the Date records of data_views (which are CST Central ...
0
votes
2answers
516 views

To Invoke Automation from SSJS

Is it possible to invoke automation from SSJS? We want to create Script Activity and based on some conditions wants to execute different automation? Can we do invoke automation using Script Activity?
0
votes
1answer
51 views

Running SFMC SSJS locally, not through SFMC

I'm developing SSJS scripts, I'm debugging connectivity issues between SFMC and 3rd party remote service. I can connect to it from my computer locally, but SFMC is having difficulties connecting. I ...
4
votes
1answer
122 views

SFMC Query 3rd party API through SSJS not on port 80 or 443

Trying to query a 3rd party API through a post request from a SSJS script. However, I get the following error: System.Net.Sockets.SocketException: A connection attempt failed because the connected ...
1
vote
0answers
41 views

Deleting User Roles Using SSJS in Marketing Cloud

I am trying to delete the user roles and permissions using SSJS (payload) in Marketing Cloud. I was able to add and update the roles, but I don't know if i can delete the roles. I was successful in ...
0
votes
1answer
526 views

SFMC - SSJS Bulk update to All Subscribers list

I would like to automate the process of updating statuses, emails and from names in All Subscribers list, but I would like to avoid using export/import or any AMPscript sitting outside of the ...
1
vote
1answer
146 views

Making soap api call from ssjs to create salesforce account record

I am trying to make a SOAP call to create new accounts and update campaign members in our sandbox salesforce crm from Marketing cloud landing page under webstudio When I publish it, I am getting ...
0
votes
1answer
432 views

Update Salesforce object with a Script Activity

I would like to create a script activity in an automation to update a Salesforce Object. Here is my example script. How can i update I get it accepted as A SSJS script in the Script Activity? %%[ ...
0
votes
1answer
195 views

How to add field to a DE using SSJS in SFMC

I have a DE called "My Demo DE" and the customer key for it is "demoDE". Now i want to add a new field to this existing DE.It my SSJS code is not adding the Field to the DE. <script runat="server"...
0
votes
0answers
168 views

Extracting the send context Data Extension fields using SSJS

I am trying to extract the send context Data Extension from an email thats being sent by placing the following code in the email itself: <script runat="server"> Platform.Load("Core", "1.1.1"); ...
2
votes
1answer
291 views

Using GTL to Display Data from Nested JSON Arrays

I am building an email using data passed through JSON. Here is an example of the JSON file: { "order": { "items": [ { *Other Data*, "tracking": [ { **"...
0
votes
1answer
163 views

Return all SSJS property value pairs for object?

I'm looking for one of two things. A complete reference guide for all SFMC SSJS objects, or A way to return all contents of an object so I can see what I need to use. For an example, I've been ...
-1
votes
1answer
106 views

Set User and Attributes - Marketing Cloud

I have implemented the following base collect code: <script type="text/javascript" src="//MID.collect.igodigital.com/collect.js"></script> <script> _etmc.push(["setOrgId", "MID"])...
0
votes
1answer
874 views

Marketing Cloud SSJS: trying to automate contact deletion

with the GDPR laws in place, it's important to have the possibility to remove contacts from Marketing Cloud. I'm trying to automate the process with existing tools and am looking for possible ...
0
votes
1answer
69 views

How to give status of triggered send back as reply on api call to landing page?

I have a cloud page that a customer accesses via an api call (do not know what kind). The call holds an email address at a time. The landing page picks up the email address, does some other stuff and ...
0
votes
1answer
119 views

Fields.Retrieve() doesn't display anything

I would like to retrieve the header of a data extension using SSJS within my Landing Page. Below is my code : <script language="javascript" runat="server"> Platform.Load("Core", "1"); ...