Skip to content

Instantly share code, notes, and snippets.

View dlisovsky's full-sized avatar
💡
Focusing

Dmitry Lisovsky dlisovsky

💡
Focusing
View GitHub Profile
insert new EmailTemplate(
FolderId = UserInfo.getOrganizationId(),
Name = 'One-Off Donation Confirmation (NPSP+)',
IsActive = true,
UIType = 'SFX',
DeveloperName = 'npsp_plus_One_Off_Donation_Confirmation',
TemplateType = 'custom',
Subject = 'Donation Confirmation',
HTMLValue = '<html> <head> <title></title> </head> <body style="height: auto; min-height: auto;"> <meta /> <span style="font-family:Arial,Helvetica,sans-serif;">Dear {{{Recipient.FirstName}}},<br /> <br /> Thank you for your support. Please confirm your donation payment using this link:&nbsp;<a href="{{{npsp_plus__Form_Submission__c.npsp_plus__Donate_URL__c}}}" target="blank">Donate</a><br /> <br /> Please contact us if you have any question.<br /> <br /> Thank you,<br /> NPSP+</span> <hr /> <img src="https://chart.googleapis.com/chart?cht=qr&amp;chs=200x200&amp;chl={{{npsp_plus__Form_Submission__c.npsp_plus__Donate_URL__c}}}&amp;choe=UTF-8" /> </body></html>',
RelatedEntityType = 'npsp_plus__Form_Sub
insert new EmailTemplate(
FolderId = UserInfo.getOrganizationId(),
Name = 'One-Off Donation Confirmation (NPSP+)',
IsActive = true,
UIType = 'SFX',
DeveloperName = 'npsp_plus_One_Off_Donation_Confirmation',
TemplateType = 'custom',
Subject = 'Donation Confirmation',
HTMLValue = '<html> <head> <title></title> </head> <body style="height: auto; min-height: auto;"> <meta /> <span style="font-family:Arial,Helvetica,sans-serif;">Dear {{{Recipient.FirstName}}},<br /> <br /> Thank you for your support. Please confirm your donation payment using this link:&nbsp;<a href="{{{npsp_plus__Form_Submission__c.npsp_plus__Donate_URL__c}}}" target="blank">Donate</a><br /> <br /> Please contact us if you have any question.<br /> <br /> Thank you,<br /> NPSP+</span> <hr /> <img src="https://chart.googleapis.com/chart?cht=qr&amp;chs=200x200&amp;chl={{{npsp_plus__Form_Submission__c.npsp_plus__Donate_URL__c}}}&amp;choe=UTF-8" /> </body></html>',
RelatedEntityType = 'npsp_plus__Form_Sub
@dlisovsky
dlisovsky / DateFormat.cls
Created February 19, 2020 16:09 — forked from tarot/DateFormat.cls
Apexでhttp-date (RFC1123)
public class DateFormat {
private static final Map<String, Integer> MONTHS = new Map<String, Integer> {
'Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4, 'May' => 5, 'Jun' => 6,
'Jul' => 7, 'Aug' => 8, 'Sep' => 9, 'Oct' => 10, 'Nov' => 11, 'Dec' => 12
};
public static Datetime fromRFC1123(String x) {
String[] dateParts = x.split('[\\s:]');
Integer year = Integer.valueOf(dateParts[3]);
@dlisovsky
dlisovsky / SendEmailTemplate.cls
Created December 10, 2019 06:05
Invocable class to send the emails from Salesforce Process Builder or Flow
global class SendEmailTemplate {
@InvocableMethod(label='Send Email using Template')
global static void sendEmail(List<EmailRequest> requests) {
try{
for (EmailRequest request : requests) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
if(String.isNotBlank(request.fromEmailAddress)){
@dlisovsky
dlisovsky / config.yml
Created November 20, 2019 10:59
Two workflows in the config.yml example
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
- run:
name: Install Dependencies
command: . build/install.sh
@dlisovsky
dlisovsky / Donate.page
Last active November 19, 2019 10:23
NPSP+ Donage page
<apex:page id="Donate"
showHeader="false"
sideBar="false"
standardStylesheets="false"
applyHtmlTag="false"
applyBodyTag="false"
title="Donate"
docType="html-5.0"
controller="DonateCtrl"
action="{!handleInit}"
@dlisovsky
dlisovsky / dto.js
Last active November 18, 2019 19:33
Donate page initial dto
{
"dto": {
"recurring": {
"amounts": [
{
"description": "Huge Support",
"amount": 50,
"isEnabled": true
},
{
@IsTest
private class vertic_CSVGeneratorTest {
static testMethod void testBehavior() {
String csv = new vertic_CSVGenerator(new List<String>{
'col1', 'col2'
}, new List<List<String>>{
new List<String>{
'val 1', 'val "2'
}
}).toString();
public virtual class vertic_CSVGenerator extends vertic_DelimiterSeparatedGenerator {
public vertic_CSVGenerator(List<String> headers, List<List<String>> rows) {
super(headers, rows);
}
public override String toString(){
return super.toString(',', '\n');
}
public virtual class vertic_DelimiterSeparatedGenerator {
public vertic_DelimiterSeparatedGenerator(List<String> headers, List<List<String>> rows) {
this.headers = headers;
this.rows = rows;
}
private List<String> headers;
private List<List<String>> rows;