Skip to content

Instantly share code, notes, and snippets.

@zuzannamj
zuzannamj / ssjs-find-de-path-form.html
Last active October 17, 2019 13:12
Simple CloudPages app for finding a Data Extension and it's folder path using SSJS. Read more here: https://sfmarketing.cloud/2019/10/14/find-a-data-extension-and-its-folder-path-using-ssjs/
<table style="padding: 20px;"><tr><td>
<b>How would you like to identify the Data Extension?</b><br>
<form action="%%=RequestParameter('PAGEURL')=%%" method="post">
<select name="DEprop">
<option value="Name">Name</option>
<option value="CustomerKey">External Key</option>
</select>
equals
<input type="text" name="DEval" value="" maxlength="128"><br>
<input type="submit" value="Submit">
@zuzannamj
zuzannamj / delete-subscriber-from-list.js
Last active October 17, 2019 13:10
Delete a Subscriber for a List using WSProxy / SSJS
<script runat="server">
Platform.Load("core","1.1.1");
var subkey = "" //provide Sunscriber Key
var email = "" //provide Email Address
var prox = new Script.Util.WSProxy();
var sub = {
SubscriberKey: subkey,
EmailAddress: email,
Lists: [{
<script runat="server">
var prox = new Script.Util.WSProxy();
var tsExKey = ''; //provide Triggered Send External Key
var EmailAddress = ''; //pass Email Address
var SubscriberKey = ''; //pass Subscriber Key
var firstName = ''; //pass First Name
var lastName = ''; //pass Last Name
var tsDef = {
TriggeredSendDefinition: {
CustomerKey: tsExKey
<script runat="server">
Platform.Load("Core", "1")
var prox = new Script.Util.WSProxy();
var tsExKey = 'External Key'; //pass Triggered Send External Key
var EmailAddress = '[email protected]'; //pass Email Address
var SubscriberKey = '[email protected]'; //pass Subscriber Key
var tsDef = {
TriggeredSendDefinition: {
CustomerKey: tsExKey
},
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<fueloauth>YOUR_ACCESS_TOKEN</fueloauth>
</Header>
<Body>
<CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Objects xsi:type="TriggeredSend">
<PartnerKey xsi:nil="true"/>
<ObjectID xsi:nil="true"/>
<TriggeredSendDefinition>
{
"Status":"OK",
"RequestID":"abcd1234",
"Results":[
{
"SubscriberFailures":[
],
"NewID":0,
"NewObjectID":null,
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">Retrieve</a:Action>
<a:ReplyTo>
<a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://{{your endpoint}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{accessToken}}</fueloauth>
</s:Header>
<script runat="server">
Platform.Load("Core","1");
var prox = new Script.Util.WSProxy();
var cols = [
"SendID",
"SubscriberKey",
"EventDate",
"EventType",
"TriggeredSendDefinitionObjectID",
"BatchID",
<script runat="server">
Platform.Load("Core","1");
var prox = new Script.Util.WSProxy();
var cols = [
"SendID",
"SubscriberKey",
"EventDate",
"EventType",
"TriggeredSendDefinitionObjectID",
"BatchID",
Your IP: %%=HTTPRequestHeader("X-Forwarded-For")=%%