Marketing Cloud application uses JavaScript code processed by Marketing Cloud servers. Instead of using the browser to render the JavaScript on the client-side computer, Marketing Cloud executes the JavaScript on the server when rendering. Use Core server-side JavaScript functions to personalize landing pages and create applications to run on Marketing Cloud. Use Platform server-side JavaScript functions to work with messages, landing pages, and applications.
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.
You can use SSJS just like ampscript to insert data/update data into a Data Extension.
<script runat="server">
var rows = Platform.Function.InsertData("CustomerData",["FirstName","LastName","Email"],["Joe","Smith","jsmith@example.com"]);
</script>
You can Read values from the Data extension using the Lookup function.
The example returns the value in the Phone field from the CustomerData data extension for the row with the SubscriberKey value of acruz@example.com.
<script runat="server">
var phoneNumber = Platform.Function.Lookup('CustomerData','Phone','SubscriberKey','acruz@example.com');
</script>
Comments
Post a Comment