Skip to content

Instantly share code, notes, and snippets.

<script runat="server">
Platform.Load("Core","1.1.1");
var output = "";
var i;
var dataRows= Platform.Function.LookupRows('Automation_Status','Flag','True');
if(dataRows && dataRows.length > 0)
{
for(i=0; i<dataRows.length; i++)
Hi Admin,<br/>
<b> Below is the status of Automation:</b><br/>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left">
<table border="1px" cellpadding="0" cellspacing="0">
<script language=javascript runat=server>
Platform.Load("core", "1")
var b1 = DataExtension.Init("Test_AddSubscribers");
var data = b1.Rows.Lookup(["IsSubscriber"], ["False"]);
if(data){
for (var i = 0; i < data.length; i++){
var status;
var EmailAddress = data[i]["EmailAddress"];
if(EmailAddress && EmailAddress != ""){
var results = Subscriber.Retrieve({
%%[
if RequestParameter("submitted") == "submitted" then
Set @EmailAddr = RequestParameter("Email")
Set @FirstName = RequestParameter("FirstName")
Set @LastName = RequestParameter("LastName")
/* Trigger Send Object Creation */
SET @ts = CreateObject("TriggeredSend")
SET @tsDef = CreateObject("TriggeredSendDefinition")
SET @ts_subkey = @EmailAddr
@naveenvm93
naveenvm93 / SFMC-Journey-Email-Tracking
Created October 11, 2019 09:23
This is used to track Journey Emails from Google Sheets
<script runat="server">
Platform.Load("Core", "1.1.1");
try {
var paramtskey = Request.GetQueryStringParameter("tskey");
var parammetric = Request.GetQueryStringParameter("metric");
if (parammetric === "all") {
var tsd = TriggeredSend.Init(paramtskey);
var triggerSendTracking = tsd.Tracking.Retrieve();
var tsTracking = Stringify(triggerSendTracking);
@naveenvm93
naveenvm93 / Integrate-Wix-With-Salesforce-Marketing-Cloud.HTML
Created November 2, 2019 09:52
Integrate-Wix-With-Salesforce-Marketing-Cloud
%%[ var @contactform,@Email, @formEmpty
set @contactform = "false"
set @formEmpty = "false"
if RequestParameter("submitted") == "submitted"
then
set @contactform = "True"
Set @Email = RequestParameter("emailaddress")
IF NOT EMPTY(RequestParameter("emailaddress"))
THEN Set @UpsertData = UpsertDE('Contact_form','1','emailaddress',@Email,'submitteddate',NOW()) Else Set @formEmpty = "True" ENDIF
ENDIF]%%
%%[
set @Country_ISO = AttributeValue("Country_ISO")
set @Subject = Lookup("Test Dynamic Email Translation","Subject","Country_ISO",@Country_ISO)
set @preheader = Lookup("Test Dynamic Email Translation","Preheader","Country_ISO",@Country_ISO)
set @Header_Image = Lookup("Test Dynamic Email Translation","Header Image","Country_ISO",@Country_ISO)
set @Header_Text = Lookup("Test Dynamic Email Translation","Header Text","Country_ISO",@Country_ISO)
set @CTA_Text = Lookup("Test Dynamic Email Translation","CTA Text","Country_ISO",@Country_ISO)
set @CTA_Link = Lookup("Test Dynamic Email Translation","CTA Link","Country_ISO",@Country_ISO)
]%%
Select T.[First Name], T.[Last Name], T.Email, dateadd(second,Tz.Time_Difference_in_Seconds_for_SFMC, DATEADD(YEAR,-(DATEDIFF(YEAR, getdate(), DateofBirth)), T.DateofBirth)) as [Local Time], T.DateofBirth, T.Country_code
from [Test Time Record] as T
JOIN [Time Zone] as Tz
on T.Country_code = Tz.Country_code
%%[
VAR @httppost,@apiid,@apistatusCode,@apiresponse,@apitoken
SET @apiid = '{"client_id": "client_id","client_secret": "client_secret", "grant_type": "client_credentials","account_id": "MID"}' /* Forming up the string for getting the access token */
SET @httppost = HTTPPost2("https://xyz.auth.marketingcloudapis.com/v2/token","application/json",@apiid,true,@apiresponse,@responseRows) /* Making a POST call to get access token */
IF(@httppost == "200") Then /* If status is Sucess */
set @rows = BuildRowsetFromString(@apiresponse,'"') /* Split the rows based on '"' string */
set @rowCount = rowCount(@rows)
if @rowCount > 0 then
for @i = 1 to @rowCount do
var @apitoken
<!DOCTYPE html>
<html>
<body>
%%[
IF RequestParameter("submitted") == "submitted" Then
VAR @httppost,@apiid,@apistatusCode,@apiresponse,@apitoken
SET @apiid = '{"client_id": "client_id","client_secret": "client_secret", "grant_type": "client_credentials","account_id": "MID"}' /* Forming up the string for getting the access token */
SET @httppost = HTTPPost2("https://xyz.auth.marketingcloudapis.com/v2/token","application/json",@apiid,true,@apiresponse,@responseRows) /* Making a POST call to get access token */
IF(@httppost == "200") Then /* If status is Sucess */
set @rows = BuildRowsetFromString(@apiresponse,'"') /* Split the rows based on '"' string */