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 / 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 / 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 / org_connection.js
Created March 25, 2019 21:15
jsforce with jwt
const jsforce = require('jsforce');
const jwt = require("salesforce-jwt-bearer-token-flow");
// create the connection to the org
let conn = new jsforce.Connection();
// load the private key for the token
let privateKey = require('fs').readFileSync('./server.key', 'utf8');
jwt.getToken({
@jeffdonthemic
jeffdonthemic / httparty.rb
Last active October 9, 2024 19:03
HTTParty Examples
options = { :body =>
{ :username => 'my',
:password => 'password'
}
}
results = HTTParty.post("http://api.topcoder.com/v2/auth", options)
##
## example for post with papertrail and basic auth
##
@jeffdonthemic
jeffdonthemic / apex-crud-fls.txt
Last active April 18, 2024 16:52
Simple Apex Controller with CRUD and FLS
This simple controller (without CRUD and FLS) ...
public with sharing class AccountController {
@AuraEnabled
public static List<Account> findAll() {
return [SELECT id, name, Location__Latitude__s, Location__Longitude__s
FROM Account
WHERE Location__Latitude__s != NULL AND Location__Longitude__s != NULL
LIMIT 50];
@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 / index.js
Last active October 27, 2023 15:42
Lambda function to commit code to github. See blog post for more details.
var githubapi = require("github"),
async = require("async"),
AWS = require('aws-sdk'),
secrets = require('./secrets.js');
// the 'handler' that lambda calls to execute our code
exports.handler = function(event, context) {
// config the sdk with our credentials
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html
@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'
@jeffdonthemic
jeffdonthemic / api-json.playground
Created August 22, 2014 18:29
Swift API call & parsing JSON
import Foundation
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely()
/**
* Paste all the code from the following file
- https://github.com/lingoer/SwiftyJSON/blob/master/SwiftyJSON/SwiftyJSON.swift
**/
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.