Skip to content

Instantly share code, notes, and snippets.

View VijayaSankarN's full-sized avatar

Vijaya Sankar N VijayaSankarN

View GitHub Profile
<script runat="server" language="JavaScript">
Platform.Load("core","1.1.2");
try {
var DE_CustomerKey = Request.GetQueryStringParameter("de_key");
var DE = DataExtension.Init(DE_CustomerKey);
var DEName = DataExtension.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:DE_CustomerKey})[0].Name;
var DEFields = DE.Fields.Retrieve();
var DEFieldsList = [];
for (var i = 0; i < DEFields.length; i++) {
%%[
/* Replace with your list ID */
SET @ListID = "<YOUR_ID>"
SET @SubscriberKey = "<Subscriber_Key>"
SET @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr,"ObjectType","ListSubscriber")
AddObjectArrayItem(@rr,"Properties","SubscriberKey")
AddObjectArrayItem(@rr,"Properties","ListID")
<script runat="server">
Platform.Load("core", "1");
var prox = new Script.Util.WSProxy();
try {
var DE = "DataExtensionObject[MyDataExtension]", // Replace 'MyDataExtension' with your Data Extension Name
options = {SaveOptions: [{'PropertyName': '*', SaveAction: 'UpdateAdd'}]},
cols = ["EmailAddress", "SubscriberKey"], // Replace the field names matching your Data Extension
moreData = true,
reqID = null,
numItems = 0;
@VijayaSankarN
VijayaSankarN / index.html
Last active December 13, 2022 11:39
Salesforce: Submit Web2Lead without reloading or refreshing the page. Details: https://vijayasankarn.wordpress.com/2022/12/13/salesforce-web-to-lead-case-without-refreshing-the-page/
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<form id="web2leadForm" action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST"> <!-- Update with the Salesforce-defined value for the action attribute -->
<input type="hidden" name="oid" id="oid" value="" /> <!-- Enter Org ID in the value -->
<input type="hidden" name="retURL" id="retURL" value="http://example.com" /> <!-- Update the return URL value -->
@VijayaSankarN
VijayaSankarN / Custom Profile or Subscription Center
Last active March 13, 2023 12:22
Marketing Cloud - Custom Preference (Profile & Subscription) Center - Profile Center using SSJS and AMPScript. (Cloud Page Solution). For explanation: https://vijayasankarn.wordpress.com/2023/03/10/marketing-cloud-custom-profile-subscription-center/
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />