Skip to content

Instantly share code, notes, and snippets.

View katydorjee's full-sized avatar
🤩

Karma Tsering Dorjee katydorjee

🤩
View GitHub Profile

AD-XX: <TOPIC - short, concise summary>

  • Date: <DATE - when the decision was made>
  • Driver: <DRIVER - list a single person driving consenus and decision making>
  • Stakeholders: <STAKEHOLDERS - list all relevant stakeholders affected by this decision>
  • Status: [PROPOSED | DECIDED | SUPERSEDED]
  • Categories: <CATEGORIES - use a simple grouping to help organize the set of decisions (e.g. backend, payment, user management, ...)>
  • Outcome: <OUTCOME - once decided, provide a short summary of the decision outcome here>

Context

@katydorjee
katydorjee / auditevents.js
Created June 26, 2022 12:46 — forked from wvpv/auditevents.js
Mirror AuditEvent Data to a Data Extension
<script runat="server" language="JavaScript">
Platform.Load("core","1");
var debug = false;
// Mirrors AuditEvent REST Object data into a data extension
// - Audit Event Log must be configured in the account first -- Email Studio > Admin > Security Settings > Enable Audit Trail Data Collection: Yes
// - creates its own data extension
// - docs: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getAuditEvents.html
// - defaults to the past 30 days of events
<script runat="server">
Platform.Load("Core","1.1.1");
var subkey = Attribute.GetValue("_subscriberkey");
var jid = Attribute.GetValue("jobid");
var lid = Attribute.GetValue("listid");
var bid = Attribute.GetValue("_JobSubscriberBatchID");
var prox = new Script.Util.WSProxy();
var props = [
@katydorjee
katydorjee / sfmc-update-salesforce-objects-with-ssjs.html
Last active May 27, 2020 11:10 — forked from wvpv/sfmc-update-salesforce-objects-with-ssjs.html
Update Salesforce Objects with Server-Side JavaScript
<script type="text/javascript" runat="server">
Platform.Load("core", "1");
var debug = 1;
if (Request.Method == "POST") {
// retrieve the input values from the form payload
var subscriberKey = Request.GetFormField("subscriberKey");
var email = Request.GetFormField("email");
@katydorjee
katydorjee / ssjs_wsproxy_updatePublist.js
Created May 23, 2020 01:35 — forked from jdeblank/ssjs_wsproxy_updatePublist.js
Use SSJS and WSProxy to add/update a subscriber status in Publication List within Salesforce Marketing Cloud
<script runat="server">
Platform.Load("core","1.1.1");
var subkey = "abc123";
var email = "[email protected]"
var prox = new Script.Util.WSProxy();
// Set specific BU context if required
// prox.setClientId({ "ID": 7279411 });
@katydorjee
katydorjee / CNX18-RASA-contact-delete.js
Created December 2, 2019 02:26 — forked from wvpv/CNX18-RASA-contact-delete.js
CNX18-RASA-contact-delete
<script type="javascript" runat="server">
Platform.Load("core","1.1.5");
var DE = "Contacts_To_Delete";
var logDE = "Contacts_To_Delete_Log";
var log = DataExtension.Init(logDE);
var url = 'https://auth.exacttargetapis.com/v1/requestToken';
var contentType = 'application/json';
<script runat="server">
Platform.Load("core","1.1.1");
var prox = new Script.Util.WSProxy();
/*
//Child BU's MID
var MID = 10000000000;
//Switch context to different BU. Change the MID to suit.
@katydorjee
katydorjee / sfmc-deduplication-with-row-number-partition.sql
Created September 14, 2018 17:02 — forked from wvpv/sfmc-deduplication-with-row-number-partition.sql
sfmc-deduplication-with-row-number-partition.sql
select
x.emailaddress
, x.subscriberkey
from (
select
w.emailaddress
, w.subscriberkey
, w.insertDate
, row_number() over (partition by w.subscriberkey order by w.insertDate asc) ranking
from Welcome_Trigger w
%%[
var @debug
var @jid
var @listid
var @batchid
var @email
var @skey
var @reason
var @unsubscribeAll
@katydorjee
katydorjee / ampscript cheat sheet.txt
Created February 6, 2017 18:39 — forked from FaldoAU/ampscript cheat sheet.txt
Dave's AMPScript Cheat Sheet
// Dave's AMPScript cheat sheet.
// AMPScript is ExactTarget (SFDC Marketing Cloud)'s server side scripting language.
// It's a bit of a pig, plus the docs are numerous and the examples aren't contextual.
// This assumes you don't need hand holding, and just need to get your head around it.
// It's also my reference for the snippets I use all the time (I'm a formatting stickler).
// These examples come from microsites I've written - adapt 'em for use elsewhere.
// Multi line AMPScript %%[contained within delimiters]%% gets interpreted on the server.