Skip to content

Instantly share code, notes, and snippets.

View dlisovsky's full-sized avatar
💡
Focusing

Dmitry Lisovsky dlisovsky

💡
Focusing
View GitHub Profile
global class InvalidContactEmailsBatch implements Database.Batchable<sObject> {
global Database.QueryLocator start(Database.BatchableContext BC) {
String invalidEmail = '%.invalid';
return Database.getQueryLocator('SELECT Id, Email FROM Contact WHERE Email != null AND (NOT Email LIKE :invalidEmail)');
}
global void execute(Database.BatchableContext BC, List<Contact> contacts) {
for (Contact contact : contacts) {
contact.Email += '.invalid';
}
public class UpdateContactPrimaryAffiliationBatch implements Database.Batchable<SObject> {
public void execute(Database.BatchableContext param1, List<Contact> contactsList) {
for (Contact contactVar : contactsList) {
contactVar.npsp__Primary_Affiliation__c = contactVar.AccountId;
contactVar.AccountId = null;
}
update contactsList;
List<Contact> updatedContactList = [
asdasd
asd
a
sda
sd
asd
as
d
asd
echo -n "this is secret" | openssl enc -e -aes-256-cbc -a -k "123" -md sha256
echo "U2FsdGVkX18GfDjxZTCJmfLlnxe3jEQMQloKtWiJ5xU="|openssl base64 -d|openssl enc -d -aes-256-cbc -k "123" -md sha256
@dlisovsky
dlisovsky / retry.cls
Last active October 4, 2022 09:56
Retry Failed VAPS
List<npsp_plus__Vertic_Async_Process__c> vaps = [SELECT Id FROM npsp_plus__Vertic_Async_Process__c WHERE npsp_plus__Status__c = 'Failed'];
for(npsp_plus__Vertic_Async_Process__c vap: vaps){
vap.npsp_plus__Status__c = 'Retrying';
vap.npsp_plus__Autorun__c = false;
}
update vaps;
npsp_plus.vertic_AsyncProcessBatch.run(new List<Id>(new Map<Id, SObject>(vaps).keySet()));
// Track the progress.
//SELECT npsp_plus__Status__c, COUNT(Id) FROM npsp_plus__Vertic_Async_Process__c GROUP BY npsp_plus__Status__c
function initElements() {
var stripe = Stripe('pk_test_18DZ3gJCF1Raph6cLhnMBjLx009D9fcNNh');
var elements = stripe.elements();
var style = {
base: {
color: '#32325d',
fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
fontSmoothing: 'antialiased',
fontSize: '16px',
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
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