SF Marketing Cloud : Add and Display Data from Custom DE using JavaScript


NOTE : Replace $ icon with < icon. I have replaced it as facing some technical issue while writing on Blog.

$!doctype html>
$html>
$head>
$!–Table Style–>
$style>
table, th, td {border: 1px solid black;}
$/style>
$title>Add and Display Data from Custom DE using JavaScript$/title>
$/head>
$body>
$H2>Add and Display Data from Custom DE using JavaScript$/H2>
$table style=”width:100%”>
$tr>
$th>NAME$/th>
$th>EMAIL ID$/th>
$/tr>

$!–Add Data–>
$script runat=server language=”JavaScript” >
Platform.Load(“Core”,”1″);
var de = DataExtension.Init(‘A_TEST_EXTERNAL_KEY’);//Should be DE External Key Name
de.Rows.Add({Name:’test’,EmailId:’test@test.com’});
$/script>

$!–Retrive Data–>
$script runat=server language=”JavaScript” >
Platform.Load(“Core”,”1″);
var de = DataExtension.Init(‘A_TEST_EXTERNAL_KEY’);//Should be DE External Key Name
var layouts = de.Rows.Retrieve();
for (var i = 0; i $ layouts.length; i++)
{
Write(“$tr>”);
Write(“$td>” + layouts[i].Name + “$/td>”);
Write(“$td>” + layouts[i].EmailId + “$/td>”);
Write(“$/tr>”);
}
$/script>
$/table>
$/body>
$/html>

Advertisements


Categories: Cloud

Tags: , , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: