How to find a data extension in SSJs?

How to find a data extension in SSJs?

In order to find a Data Extension, we will use two SSJS Core functions: DataExtension.Retrieve and Folder.Retrieve. The first function will help us identify the Data Extension, either by its name or the External Key.

How to move a data extension to a new folder?

In order to move the Data Extension to a new folder, we can simply get the Category ID of the folder with a specific name and add a new property in the object that we use for adding the Data Extension.

How to create a data extension with server-side JavaScript?

The following code will create a Data Extension named MyDataExtension or will throw an error if this Data Extension already exists.

How to create server side JavaScript in Marketing Cloud?

Server-side JavaScript does not work with the DOM and will not function with exterior libraries. Instead, use libraries provided by Marketing Cloud to create server-side JavaScript. All functions native to JavaScript, such as arrays, math functions, the EVAL function, and try catch blocks work with server-side JavaScript.

How to use server side JavaScript in email?

You can use more advanced exception handling with server-side JavaScript. You should exclusively use AMPscript or Platform object server-side JavaScript functions in email messages and reserve your use of Core library server-side JavaScript to landing pages and applications.

Are there any REST API methods in SSJs?

This severely limits your API capabilities, both internally for Salesforce Marketing Cloud (SFMC) and to any external resource. Is there any way via AMPScript or SSJS to utilize HTTP methods outside of GET and POST?

Where to find field API names in SSJs?

You can view the field API Names under Setup > Object Manager – go to the object you wish to view and click on Fields & Relationships. For the Subscriber custom object, note that the object name is Subscriber__c and the field names are as shown in the previous image.

How to send marketing cloud data to SF CRM using SSJs?

We shall be using SSJS and REST API along with Salesforce Bulk API 2.0. Bulk API provides an interface by which we can quickly load large amounts of data into our Salesforce org – the 2.0 version being the new and updated one.

How to script a list of files in SSIs?

For the SSIS scripting part, we could go in one of several different directions: Use a script task to write the list of files to an SSIS variable, and separately process the resulting list of files using another script, an SSIS foreach loop, etc.

How to move data extension from one folder to another?

Moving a Data Extension from one folder to another is the matter of changing it’s CategoryID attribute. In order to delete anything in Marketing Cloud, CustomerKey is just not enough. Providing the ObjectID and the name of the object we want to delete is how it becomes possible.

How to add a record to a data extension?

To add records manually, you need to go into the data extension click on the Records tab and click on add record button. I am not able to add the record manually , it is throwing error to contact sfmc support when i am saving the record but when i use ssjs to insert record in that de it is working fine.

Is there a way to read data from ampscript?

If you’ve been coding for Marketing Cloud long enough, you’ve realized that sometimes AMPscript is just not enough. There is no way to properly debug it, add Data Extension fields if they don’t exist or look up every row without using any criteria.

What can I do with SSJs in script activities?

Let’s say we have 2 Data Extensions as follows: Now the company has a requirement to have the EventDetailsDE updated every night with the Coupon information for each Event ID: This can be easily achieved with a fairly simple script in SSJS as shown in the following section.