Skip to content

Instantly share code, notes, and snippets.

View conrjac's full-sized avatar
🪁
Focusing

Connor Jackson conrjac

🪁
Focusing
View GitHub Profile
@conrjac
conrjac / keybase.md
Created April 11, 2023 21:01
keybase.md

Keybase proof

I hereby claim:

  • I am conrjac on github.
  • I am conrjac (https://keybase.io/conrjac) on keybase.
  • I have a public key ASBmzuMgGnaJPHab5kk3-Fp-4DGoAve0OEpqi_fMHDXLyQo

To claim this, I am signing this object:

@conrjac
conrjac / SalesforceObjectKeyPrefixes.md
Created March 8, 2023 21:16
Salesforce Object Key Prefixes
KeyPrefix Label DeveloperName
800 Contract Contract
017 Contract History ContractHistory
0D5 Contract Feed ContractFeed
1CE Contract Change Event ContractChangeEvent
801 Order Order
0Fy Order Share OrderShare
017 Order History OrderHistory
0D5 Order Feed OrderFeed
@conrjac
conrjac / ExampleUsingQuery.cls
Created June 11, 2021 20:42
SOQL Query to determine if your org is a sandbox
Organization currentOrg = [SELECT Id, IsSandbox, Name FROM Organization LIMIT 1];
If(currentOrg.IsSandbox == True)
{
System.Debug('Your in a sandbox!');
}
@conrjac
conrjac / CallingClass.cls
Last active June 11, 2021 20:30
Determine Org Type via Apex
' Controller/Trigger calling:
system.debug(' o ' + Utility.isSandbox());
' If Statement Example
If(Utility.isSandbox())
{
' Run this code, as current enviroment is a sandbox
}
@conrjac
conrjac / .gitignore
Created August 28, 2020 14:14
SFDX .gitIgnore
# Salesforce cache
.sfdx/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
@conrjac
conrjac / Clone Permission Set Assignments.cls
Last active July 17, 2020 09:41
Clone Permission Set Assignments
Id oldPermissionSetId = 'PERMISSION_SET_ID';
Id newPermissionSetId = 'PERMISSION_SET_ID';
List<PermissionSetAssignment> currentAssignments = [SELECT AssigneeId FROM PermissionSetAssignment WHERE PermissionSetId = :oldPermissionSetId AND AssigneeId IN (SELECT Id FROM User WHERE IsActive = TRUE)];List<PermissionSetAssignment> newAssignments = new List<PermissionSetAssignment>();For(PermissionSetAssignment psa : currentAssignments) newAssignments.add(new PermissionSetAssignment(AssigneeId = psa.AssigneeId, PermissionSetId = newPermissionSetId));
Insert newAssignments;
@conrjac
conrjac / IdeaCommentTrigger.apxt
Created June 25, 2019 10:55
IdeaCommentTrigger
trigger IdeaCommentTrigger on IdeaComment (before insert, after insert, before update, after update, before delete, after delete, after undelete) {
IdeaCommentTriggerHandler.handleTrigger(Trigger.new, Trigger.old, Trigger.operationType);
}
@conrjac
conrjac / IdeaCommentTriggerHandlerTest.apxc
Created June 25, 2019 10:55
IdeaCommentTriggerHandlerTest
@isTest
private class IdeaCommentTriggerHandlerTest {
@testSetup static void testDataGenerator() {
Idea i = new Idea();
i.Title = 'Test Idea';
i.Body = 'Test Idea Body';
i.CommunityId = [SELECT Id FROM Community LIMIT 1].id;
insert i;
}
@conrjac
conrjac / IdeaCommentTriggerHandler.apxc
Created June 25, 2019 10:53
IdeaCommentTriggerHandler
public class IdeaCommentTriggerHandler {
public static void handleTrigger(List<IdeaComment> workingRecords, List<IdeaComment> oldRecords, System.TriggerOperation triggerEvent ) {
final Id orgWideAddress = [select Id from OrgWideEmailAddress WHERE Address ='salesforce@your.org'].Id; // You should consider using a custom setting to manage this - certainly do not hardcode an address Id!
switch on triggerEvent {
when AFTER_INSERT, AFTER_UPDATE{

Keybase proof

I hereby claim:

  • I am conrjac on github.
  • I am conrjac (https://keybase.io/conrjac) on keybase.
  • I have a public key ASDcqqS9qBjEwNjtnSZHhXk7foPhh8TexW8ywhY6aYXNMwo

To claim this, I am signing this object: