Skip to content

Instantly share code, notes, and snippets.

View jeffdonthemic's full-sized avatar
💭
Currently being awesome

Jeff Douglas jeffdonthemic

💭
Currently being awesome
View GitHub Profile
@jeffdonthemic
jeffdonthemic / demo.md
Created September 15, 2025 16:31
Demo rules for Salesforce

General Requirements

  • When calling the Salesforce CLI, always use sf. Never use the deprecated sfdx or the sfdx-style commands.
  • Always use an existing Salesforce DX MCP server tool before calling the sf CLI.

CUSTOM OBJECTS

  • Always use an Autonumber fields for all custom objects
  • Do not make any custom fields required
  • Create a Tab for each custom object
  • Always set the custom object as deployed with:
@jeffdonthemic
jeffdonthemic / salesforce-rules.md
Last active September 16, 2025 15:17
Salesforce Development Rules for A4D, Cline, Cursor, Claude Code, etc.

Salesforce Development Rules for Cline

You are a highly experienced and certified Salesforce Architect with 20+ years of experience designing and implementing complex, enterprise-level Salesforce solutions for Fortune 500 companies. You are recognized for your deep expertise in system architecture, data modeling, integration strategies, and governance best practices. Your primary focus is always on creating solutions that are scalable, maintainable, secure, and performant for the long term. You prioritize the following:

  • Architectural Integrity: You think big-picture, ensuring any new application or feature aligns with the existing enterprise architecture and avoids technical debt.
  • Data Model & Integrity: You design efficient and future-proof data models, prioritizing data quality and relationship integrity.
  • Integration & APIs: You are an expert in integrating Salesforce with external systems, recommending robust, secure, and efficient integration patterns (e.g., event-driven vs. REST APIs).
  • Securi
@jeffdonthemic
jeffdonthemic / datacloud-ingestion-insert.rb
Last active December 7, 2023 15:12
Using the Data Cloud Ingestion to insert records with JWT connected app
require 'jwt'
require "faraday"
require "uri"
def token
private_key = './keys/server.key'
priv_key = OpenSSL::PKey::RSA.new(File.read(private_key))
JWT.encode payload, priv_key, 'RS256'
end
@jeffdonthemic
jeffdonthemic / Gemfile
Last active August 15, 2023 14:46
Salesforce 2GP Packaging CLI
source 'https://rubygems.org'
gem 'restforce', '~> 6.2.2'
gem 'thor'
public class AnimalsCallouts {
public static HttpResponse makeGetCallout() {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
request.setMethod('GET');
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if(response.getStatusCode() == 200) {
// Deserializes the JSON string into collections of primitive data types.
const jsforce = require('jsforce');
const { exec } = require('child_process');
exec("sfdx org display --json", (error, stdout, stderr) => {
let org = JSON.parse(stdout);
console.log('=================');
console.log(org.result.username);
console.log(org.result.instanceUrl);
console.log('=================');
@jeffdonthemic
jeffdonthemic / signer.rb
Last active May 9, 2023 17:48
Ruby crypto sign/verify
require 'openssl'
require 'base64'
private_key = File.read("./salesforce_private.key")
public_key = File.read("./salesforce_public.key")
data = "reports50"
priv_key = OpenSSL::PKey::RSA.new(private_key)
signature = priv_key.sign_pss("RSA-SHA512", data, salt_length: :digest, mgf1_hash: "RSA-SHA512")
@jeffdonthemic
jeffdonthemic / signer.js
Last active May 4, 2023 17:53
Node crypto sign/verify
const crypto = require('crypto')
const fs = require('fs')
function sign(plainText) {
const sign = crypto.createSign('RSA-SHA512')
sign.update(Buffer.from(plainText, 'utf8'))
signature = sign.sign(
{
key: fs.readFileSync('./salesforce_private.key', 'utf8'),
padding:crypto.constants.RSA_PKCS1_PSS_PADDING
public with sharing class EncryptionService {
// Keys are here for testing purposes. NEVER DO THIS!!!
// Use an approved secrets management solution like Shield Platform Encryption
public static final Blob PRIVATE_KEY = EncodingUtil.base64Decode(
'IMAGE-A-LOT-MORE-LINES-HERE\n' +
'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCS7LXFvLFELXwy\n' +
'UVKIYJEI3j/7b4HUIOJ1IU1la1g2Vr5SKPn+GziMFhFcBjx6LlJxAkJQlOgBOnkO\n' +
'cHC3etOoAsrrRh4LPzZ6CXQeSRjilQnzaCdq2CIu+f8UqVWbwPtb3K/aQAX905Ck\n' +
@jeffdonthemic
jeffdonthemic / clickupservice.cls
Created February 16, 2023 20:25
Apex REST GET
public with sharing class ClickUpTaskService {
private static String apiKey = '';
public static void call() {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://api.clickup.com/api/v2/list/900600512507/task');
request.setMethod('GET');