Skip to content

Instantly share code, notes, and snippets.

View wvpv's full-sized avatar

Adam Spriggs wvpv

View GitHub Profile
@wvpv
wvpv / sfmc-ampscript-flexible-content-areas-with-xml3.amp
Created December 11, 2015 18:21
SFMC AMPScript Flexible Content Areas with XML Interfaces 3
%%[
set @node = BuildRowsetFromXML(@productXML,concat("/products/product[",@productPos,"]/productImageURL"),1)
set @productImageURL = Field(Row(@node, 1),'Value')
]%%
@wvpv
wvpv / sfmc-ampscript-flexible-content-areas-with-xml4.html
Last active December 11, 2015 18:23
SFMC AMPScript Flexible Content Areas with XML Interfaces 4
<img style="display: block;" src="%%=v(@productImageURL)=%%" alt="" width="150" border="1" />
@wvpv
wvpv / sfmc-ampscript-upsert-data-extension-row.amp
Created December 15, 2015 16:54
SFMC AMPScript Upsert/UpdateAdd Data Extension Row
%%[
VAR @deObj, @prop, @de_statusCode, @de_statusMsg, @errorCode
var @FirstName, @LastName, @Email, @SubscriberKey
set @FirstName = RequestParameter("FirstName")
set @LastName = RequestParameter("LastName")
set @Email = RequestParameter("Email")
set @SubscriberKey = RequestParameter("SubscriberKey")
@wvpv
wvpv / sfmc-ampscript-preference-center-test.html
Created December 15, 2015 17:13
SFMC AMPScript preference center test email
<html>
<body style="font-family:sans-serif">
<a href="%%profile_center_url%%">Base - Profile/Preference Center</a>
<br/><a href="%%subscription_center_url%%">Base - Subscription Center</a>
<br/><a href="%%unsub_center_url%%">Base - One-Click Unsubscribe</a>
<br/><a href='%%=MicrositeURL(1111,"subscriberMID", "4444")=%%'>Custom Profile/Preference Center</a>
<br/><a href='%%=MicrositeURL(2222,"subscriberMID", "4444")=%%'>Custom Subscription Center</a>
<br/><a href='%%=MicrositeURL(3333,"subscriberMID", "4444")=%%'>One-Click Unsubscribe</a>
<p>This email was sent by:
<b>%%Member_Busname%%</b>
@wvpv
wvpv / VBScript-Conditionally-Hide-Columns-in-Excel.vbs
Created December 15, 2015 19:52
Conditionally Hide Columns in Excel via VBScript
Sub header()
Dim eCol As Integer
Dim i As Integer
eCol = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To eCol
With Cells(1, i)
@wvpv
wvpv / VBScript-Move-Sent-Items-to-Inbox-in-Outlook.vbs
Created December 15, 2015 19:57
VBScript Move Sent Items to Inbox in Outlook
Function GetFolderPath(ByVal FolderPath As String) As Outlook.Folder
Dim oFolder As Outlook.Folder
Dim FoldersArray As Variant
Dim i As Integer
On Error GoTo GetFolderPath_Error
If Left(FolderPath, 2) = "\\" Then
FolderPath = Right(FolderPath, Len(FolderPath) - 2)
@wvpv
wvpv / sfmc-sql-enterprise-attributes.sql
Last active June 15, 2019 19:00
SFMC SQL select profile attributes values from the EnterpriseAtrributes data view
select
a.customerID
, s.emailAddress
from EnterpriseAttributes a
inner join _Subscribers s on (s.subscriberID = a.subscriberID)
@wvpv
wvpv / SFMC-AMPScript-Upsert-Data-Extension-Row.amp
Created December 21, 2015 16:44
SFMC AMPScript Upsert Data Extension Row
%%[
var @firstName, @lastName
set @firstName = "Scut"
set @lastName = "Farcus"
UpsertDE("My_Test_DataExtension",1,"SubscriberKey",_SubscriberKey,"FirstName",@firstName,"LastName",@lastName)
]%%
%%[
var @em, @couponRow, @couponCode
if _messagecontext == "PREVIEW" then
set @couponCode = "XX TEST XX"
else
@wvpv
wvpv / SFMC-SSJS-retrieve-start-automation.js
Created March 17, 2016 16:18
SFMC SSJS Retrieve and Start and Automation
<script runat="server">
Platform.Load("Core","1.1.1");
var automationCustomerKey = "CUSTOMERKEY-OF-AUTOMATION"
var rr = Platform.Function.CreateObject("RetrieveRequest");
Platform.Function.SetObjectProperty(rr, "ObjectType", "Automation");
Platform.Function.AddObjectArrayItem(rr, "Properties", "ProgramID");
Platform.Function.AddObjectArrayItem(rr, "Properties", "CustomerKey");