This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Campaign> exampleTwo = new List<Campaign>([SELECT Id, Name FROM Campaign WHERE Type = 'Email']); | |
List <CampaignMemberStatus> newStati = new List <CampaignMemberStatus> (); | |
for (Campaign camp : exampleTwo) { | |
CampaignMemberStatus newStat = new CampaignMemberStatus(); | |
newStat.CampaignID = camp.Id; | |
newStat.Label= 'Subscribed'; | |
newStati.add(newStat); | |
} | |
insert newStati; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Instructions | |
//In your developer console in your sandbox, find the class called yearEndGiftBatchTest | |
//and replace all the code with this code. | |
//You don't need to modify this code at all. | |
//Code by Jessie Rymph | |
//January 12, 2023 | |
//Tests the Year End Gift Batch process using the YearEndtestDataFactory class | |
//https://wp.me/p9qPLI-1q8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class qGiftsLastYear implements Database.Batchable<sObject> | |
//,Database.Stateful | |
{ | |
//ideally it could be invoked by a flow but that's not being used in this version | |
@InvocableMethod(description='Year End Tax Flow' ) | |
public static void yearEndTaxMethod () { | |
database.executeBatch(new qGiftsLastYear(),10); } | |
public Database.QueryLocator start(Database.BatchableContext bc) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** This visualforce page allows you to total up columns, total up rows, and total it all up, just like you would in excel! | |
<apex:page StandardController="outfunds__Funding_Request__c" lightningStylesheets="true"> | |
<apex:slds /> | |
<apex:form id="form"> | |
<apex:outputText value="Voices for Healthy Kids Budget Planning Tool" id="header"/> | |
<apex:panelGrid columns="4" id="theGrid"> | |
<apex:outputText value="" id="thefirst"/> | |
<apex:outputText value="Non Lobbying" id="theSecond"/> | |
<apex:outputText value="Lobbying" id="theThird"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This works but times out with too big of a spreadsheet | |
public class sfdoIdo_addContactsByState { | |
@InvocableMethod (label = 'Select State for Maps' description = 'select states for map.') | |
//Query your files in static resources and get their content as String | |
public static void getStatesList (List<String> states) { | |
StaticResource ctcSR = [SELECT Id, Body FROM StaticResource WHERE Name = 'sfdoido_Contact' LIMIT 1]; | |
String bodyCtcSR = ctcSR.Body.toString(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class yearEndCampaignTable implements | |
Database.Batchable<sObject>,Database.Stateful { | |
//instance member to retain state across transactions | |
public static Integer emailLimits; | |
public Integer recordsProcessed =0; | |
public Database.QueryLocator start(Database.BatchableContext bc) { | |
Integer year = Date.Today().year()-1; | |
return Database.getQueryLocator([SELECT LastName, id,Gifts_Last_Year__c, (SELECT Id, CloseDate, Amount, Campaign.Name FROM Opportunities | |
WHERE CALENDAR_YEAR(CloseDate) =:year AND IsWon = True ORDER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class contactsListAction { | |
//this invocable method takes a single contact from Flow from a text variable | |
//and returns a list of lists of opportunities associated with that contact. | |
//the list of lists is stored as a collection variable in the Flow. | |
@InvocableMethod (label = 'SendContactsGet Opps' description = 'returns opps for this contact.') | |
//the method will return a List of Lists of Opportunities, and receive a List of Salesforce ids | |
public static List<List<Opportunity>> getContactIds (List<ID> ids) { | |
//declare a new list of Opps | |
List <Opportunity> oppIds = new List <Opportunity> (); | |
//declare a new list of lists of opps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Classic Contact HTML Email Template | |
Dear {!Contact.FirstName} {!Contact.LastName}, </br> | |
<a href="https://InsertYourSiteDomainHere/Unsubscribe?recordId={!Contact.Id}&Email={!Contact.Email}">Click here to unsubscribe from all emails from our organization.</a> | |
</br> | |
Instructions: </br> | |
<li>Change ONLY this part of the HTML above:</li> | |
InsertYourSiteDomainHere</br> | |
to the Site Domain you saved earlier.</br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Controller by Jessie Rymph included with unmanaged package Unsubscribe Link from AppExchange & Salesforce Labs. | |
//the controller tells the visualforce page jrsl_ul_UnsubscribeFinish to display text if a custom metadata type says "Yes" to a confirmation email | |
//April 9, 2021 | |
public without sharing class jrsl_ul_UnsubscribeController { | |
private final jrsl_ul_Unsubscribe_Link__mdt uLmDt; | |
public string displayText {get; set;} | |
public boolean booly {get; set;} | |
public jrsl_ul_UnsubscribeController(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.biswajeetsamal.com/blog/create-or-update-custom-metadata-type-using-apex/ | |
public class CustomMetadataUtils implements Metadata.DeployCallback { | |
//Interface method | |
public void handleResult(Metadata.DeployResult result, Metadata.DeployCallbackContext context) { | |
if (result.status == Metadata.DeployStatus.Succeeded) { | |
//Success | |
System.debug('Success Result-' + result); | |
} else { | |
//Failed |
NewerOlder