Skip to content

Instantly share code, notes, and snippets.

Avatar

Karma Tsering Dorjee katydorjee

View GitHub Profile
@katydorjee
katydorjee / Create folder in email studio Data Extension using SSJS.js
Created Jun 16, 2020
Create folder in email studio Data Extension using SSJS
View Create folder in email studio Data Extension using SSJS.js
<script runat=server>
Platform.Load("core","1");
var newFolder = {
"Name" : "Name_of_the_folder",
"CustomerKey" : Platform.Function.GUID(),
"Description" : "Description_of_the_folder",
"ContentType" : "dataextension",
"IsActive" : "true",
View LogUnsubEvent-wsproxy.js
<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 / Select SQL to return records modified in the last hour.sql
Created Jun 4, 2020
Select SQL to return records modified in the last hour
View Select SQL to return records modified in the last hour.sql
SELECT Id,
Email,
FirstName,
LastModifiedDate,
CurrentDateTime
FROM (
SELECT Id,
Email,
FirstName,
LastModifiedDate at time zone 'Central America Standard Time' at time zone 'Aus Eastern Standard Time' LastModifiedDate,
@katydorjee
katydorjee / sfmc-update-salesforce-objects-with-ssjs.html
Last active May 27, 2020 — forked from wvpv/sfmc-update-salesforce-objects-with-ssjs.html
Update Salesforce Objects with Server-Side JavaScript
View sfmc-update-salesforce-objects-with-ssjs.html
<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 / SFMC CloudPage Consume content from Dropbox.html
Created May 25, 2020
SFMC CloudPage Consume content from Dropbox
View SFMC CloudPage Consume content from Dropbox.html
<script runat='server'>
Platform.Load('Core','1');
try{
</script>
%%=TreatAsContent(HTTPGet('https://dl.dropbox.com/s/dropbox_file_Id/fileName.html'))=%%
<script runat='server'>
}catch (ex){
Write(Stringify(ex));
}
</script>
@katydorjee
katydorjee / Update Marketing Cloud All Subscribers using SSJS.js
Last active May 23, 2020
Update Marketing Cloud All Subscribers using SSJS
View Update Marketing Cloud All Subscribers using SSJS.js
<script runat="server">
Platform.Load("core", "1.1.1");
var subscriber = {
SubscriberKey: "S_10001",
"Attributes": {
'First Name': "Karmab",
"Last Name": "Dorjeeb"
},
"Lists": {"ID": 101}
@katydorjee
katydorjee / ssjs_wsproxy_updatePublist.js
Created May 23, 2020 — forked from jdeblank/ssjs_wsproxy_updatePublist.js
Use SSJS and WSProxy to add/update a subscriber status in Publication List within Salesforce Marketing Cloud
View ssjs_wsproxy_updatePublist.js
<script runat="server">
Platform.Load("core","1.1.1");
var subkey = "abc123";
var email = "foo@bar.com"
var prox = new Script.Util.WSProxy();
// Set specific BU context if required
// prox.setClientId({ "ID": 7279411 });
@katydorjee
katydorjee / test_sfmc_CloudPage.html
Last active Jun 2, 2021
CloudPage (SFMC) Consume content from Github
View test_sfmc_CloudPage.html
%%[
var @name
set @name = 'Dorjee'
]%%
Hello, my name is %%=v(@name)=%% <br>
Today is: %%=Format(Now(), "MMMM d, yyyy")=%%
View CNX18-RASA-contact-delete.js
<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';
@katydorjee
katydorjee / Update Salesforce Object Using SSJS.js
Last active Apr 15, 2020
Update Salesforce Object Using SSJS
View Update Salesforce Object Using SSJS.js
<script runat="server">
Platform.Load("core","1.1.1");
var sfUpdateString;
var targetDE = DataExtension.Init('External Key').Rows.Retrieve();
for (var i = 0; i < targetDE.length; i++)
{
var Field1 = targetDE[i].Field1;
var Field2 = targetDE[i].Field2;