Skip to content

Instantly share code, notes, and snippets.

View VijayaSankarN's full-sized avatar

Vijaya Sankar N VijayaSankarN

View GitHub Profile
@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" />
@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 -->
<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;
%%[
/* 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" 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++) {
@VijayaSankarN
VijayaSankarN / Custom Preference Center.html
Last active May 30, 2022 12:09
Marketing Cloud - Custom Preference Center - Profile Center using SSJS and AMPScript. (Cloud Page Solution)
<!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" />
</head>
<body>
@VijayaSankarN
VijayaSankarN / ResponsiveLightningDataTable.css
Last active September 17, 2020 12:45
Responsive Table that convers Table Columns to Rows along with Labels
/* RESPONSIVE LIGHTNING DATATABLE - SALESFORCE (With Checkbox)
* https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable/example
*/
@media (max-width: 768px) {
.THIS lightning-datatable.responsive-table thead th:not(:first-child) {
display: none;
}
.THIS lightning-datatable.responsive-table thead th:first-child .slds-checkbox:after {
content: 'Select All';
@VijayaSankarN
VijayaSankarN / FizzBuzz.php
Created January 9, 2019 09:02
Fizz Buzz Test
for($i=1;$i<100;$i++) {
echo ($i%3?'':'Fizz').($i%5?'':'Buzz')?:$i,"<br/>";
}
@VijayaSankarN
VijayaSankarN / BooleanExpression.cls
Created July 5, 2018 06:31
Apex class to evaluate a Boolean expression
/***************************************************************************************************
* Class Name : BooleanExpression
* Created Date : July 4, 2018
* Author : Vijaya Sankar N
* Description : Class to evaluate a boolean expression
* Example : (TRUE AND (FALSE OR TRUE)) is TRUE
****************************************************************************************************/
public class BooleanExpression {
static Map<String, String> logicTypes = new Map<String, String>();
static Map<String, Map<String, String>> expressionLogic = new Map<String, Map<String, String>>();
@VijayaSankarN
VijayaSankarN / sharepointRESTService.js
Created July 24, 2017 11:40
SharePoint - Angular REST API base class for lists
(function() {
angular.module('myApp').factory('sharepointRESTService', sharepointRESTService)
sharepointRESTService.$inject = ['$q', '$http', '$location'];
function sharepointRESTService($q, $http, $location) {
var factoryUtil = {};
var domain_url = "https://company_name.sharepoint.com/sites/site_name";
// HTTP GET