Skip to content

Instantly share code, notes, and snippets.

@jkentjnr
jkentjnr / convert.apex
Created October 19, 2023 11:01
Salesforce_Lead_Convert
// Set lead Id here.
Id leadId = '00Q8t0000024px3EAA';
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted = true LIMIT 1];
String leadStatus = convertStatus.MasterLabel;
// Execute Salesforce' lead convert service
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(leadId);
lc.setConvertedStatus(leadStatus);
@jkentjnr
jkentjnr / copy_between_orgs.sh
Created April 6, 2023 04:55
Salesforce: Publish Between Orgs using SFDX
sfdx alias set awh_production=developer+abc@movedata.io
sfdx force auth web login -a abc_production
sfdx alias set whf_sandbox=developer+xyz@movedata.io.movedata
sfdx force auth web login -a xyz_sandbox -r https://xyzfoundation--movedata.sandbox.my.salesforce.com
sfdx force:mdapi:retrieve -k package.xml -s -r . -u abc_production
unzip ./unpackaged.zip -d ./unpackaged
sfdx force:mdapi:deploy -d ./unpackaged -w 10 -u xyz_sandbox
@jkentjnr
jkentjnr / DDMMYYY_to_Date.txt
Last active April 16, 2024 04:35
Bespoke Salesforce Formulas
DATE(
VALUE(RIGHT({!InvoiceDate}, 4)),
VALUE(
MID(
{!InvoiceDate},
FIND("/", {!InvoiceDate}) + 1,
FIND("/", {!InvoiceDate}, (FIND("/", {!InvoiceDate}) + 1)) - FIND("/", {!InvoiceDate}) - 1
)
),
VALUE(LEFT({!InvoiceDate}, FIND("/", {!InvoiceDate}) - 1))
@jkentjnr
jkentjnr / sfdx-deploy.yaml
Created November 21, 2022 09:21
Azure DevOps Pipeline Template for Salesforce DX Sandbox Deployment
# ----------------------------------------------------------------------------------------------------
# SFDX Deploy
# ----------------------------------------------------------------------------------------------------
parameters:
pool: {}
jobs:
- deployment: sfdx_deploy
displayName: SFDX Deploy
@jkentjnr
jkentjnr / clean.apex
Last active February 15, 2023 04:25
Clean out MD Development Environments
delete [SELECT Id FROM Opportunity LIMIT 2000];
delete [SELECT Id FROM npe03__Recurring_Donation__c LIMIT 2000];
delete [SELECT Id FROM Case LIMIT 2000];
delete [SELECT Id FROM Contact LIMIT 2000];
delete [SELECT Id FROM Account LIMIT 2000];
delete [SELECT Id FROM md_npsp_pack__Platform_Key__c LIMIT 2000];
delete [SELECT Id FROM md_forms_pack__Contact_Platform_Key__c LIMIT 2000];
delete [SELECT Id FROM md_forms_pack__Account_Platform_Key__c LIMIT 2000];
delete [SELECT Id FROM Campaign LIMIT 2000];
delete [SELECT Id FROM md_npsp_pack__Question_Response__c LIMIT 2000];
@jkentjnr
jkentjnr / ContactDuplicateRule.txt
Last active August 16, 2022 11:42
Duplicate Detection via Apex
Rule Name: MoveData Contact Duplicate
Rule Order: 3 of 3
Object: Contact
Record-Level Security: Enforce sharing rules
Action On Create: Allow
Operations On Create: Alert / Report
Action On Edit: Allow
Operations On Edit: Alert / Report
Alert Text: Use one of these records?
Active; Checked
resource "aws_api_gateway_method" "graphRoot" {
rest_api_id = aws_api_gateway_rest_api.api.id
resource_id = aws_api_gateway_resource.graphRoot.id
http_method = "POST"
authorization = "COGNITO_USER_POOLS"
authorizer_id = aws_api_gateway_authorizer.cognito.id
}
resource "aws_api_gateway_integration" "graphRoot" {
rest_api_id = aws_api_gateway_rest_api.api.id
@jkentjnr
jkentjnr / graphBuilder.apex
Created October 14, 2019 12:38
Graphql Builder for Salesforce Apex
public class GraphBuilder {
/*
EXAMPLE
-------
String q = new GraphBuilder.QueryOperation(
new GraphBuilder.QueryResolver(
'notification',
@jkentjnr
jkentjnr / README.md
Last active May 14, 2019 11:56
Campaign Setup Steps

Grassrootz Setup Steps


  • Create a campaign at Grassrootz

This will ensure the campaign is pushed to Salesforce. At this point, you will need to configure your campaign. Navigate to the newly created campaign in Salesforce.

  • Rename the campaign if so desired.
  • Configure the Start and End dates for the Campaign
@jkentjnr
jkentjnr / readme.md
Created August 28, 2018 10:28
SVG Product Configurator Overview

We are looking for an experienced developer to build and deliver a website for a customer. This organisation works with businesses, clubs, sports clubs, etc to deliver customised clothing. They are looking for the ability for configure the clothes online using SVG. A good example of how this can be done can be viewed here: http://www.reformclothing.com/us/design-your-own/custom-varsity-jacket

See the tech / specifications below:

We will provide a template or a design than will need to be configured to work with React, etc.

Milestones: