Skip to content

Instantly share code, notes, and snippets.

View surajp's full-sized avatar
😄
Focusing

Suraj Pillai surajp

😄
Focusing
View GitHub Profile
@surajp
surajp / sfschema.txt
Created April 19, 2025 04:57
sf standard schema 2025
EntityName,FieldName
AIPredictionEvent,ReplayId
AIPredictionEvent,CreatedDate
AIPredictionEvent,CreatedById
AIPredictionEvent,EventUuid
AIPredictionEvent,PredictionEntityId
AIPredictionEvent,InsightId
AIPredictionEvent,TargetId
AIPredictionEvent,Confidence
AIPredictionEvent,FieldName
@surajp
surajp / LimitsIllustratorTest.cls
Last active March 20, 2025 17:51
Demonstrates increased limits in Apex tests
@IsTest
public class LimitsIllustratorTest {
private static final Integer RECORDS_TO_INSERT_PER_ITERATION = 9000;
private static final INTEGER SOQL_QUERIES_PER_ITERATION = 40;
private static final Integer FUTURE_METHOD_ITERATIONS = 3; //you can go upto 50 here theoretically, but Salesforce will kill the test after a while
@TestSetup
private static void setup() {
Test.startTest();
for (Integer i = 0; i < FUTURE_METHOD_ITERATIONS; i++) {
LimitsIllustratorTest.insertAccounts(i);
@surajp
surajp / postman-sf-auth-collection.json
Last active March 5, 2025 05:39
Get access token in Postman from the Salesforce cli via a node server
{
"info": {
"_postman_id": "35d1388c-2a10-4698-9cd6-6fb250c2b458",
"name": "Local SF Auth",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "1474473",
"_collection_link": "https://team-sf.postman.co/workspace/Salesforce~e589a405-8419-4e78-9608-343f0d307f55/collection/1474473-35d1388c-2a10-4698-9cd6-6fb250c2b458?action=share&source=collection_link&creator=1474473"
},
"item": [
{
@surajp
surajp / createTestSuite.cls
Last active June 29, 2024 21:37
Anonymous apex to create test suite
class Membership {
Id apexClassId;
Id apexTestSuiteId;
public Membership(Id suiteId, Id classId) {
this.apexTestSuiteId = suiteId;
this.apexClassId = classId;
}
}
String suiteName = 'My_Test_Suite';
@surajp
surajp / dynaComp.html
Created August 15, 2023 17:27
Custom Elements in LWC
<template>
<h2>Dynamic Component</h2>
<div lwc:dom="manual" class="container"></div>
</template>
@surajp
surajp / sfRestApi.sh
Last active February 9, 2023 19:15
A script for invoking SF REST APIs from the command line using session id from sfdx
#!/usr/bin/env bash
set -euo pipefail
# A script for invoking SF REST APIs using session id from sfdx
if [[ $1 = "-h" || $1 = "-help" ]]; then
echo "Usage: $(basename $0) <org username/alias> <path starting from version number> <additional request info>"
exit 1
fi
@surajp
surajp / traceFlag.sh
Created October 13, 2022 14:53
Add debug logs for a user
#!/usr/bin/env bash
set -euo pipefail
usage="./traceFlag.sh <traced user name>(defaults to 'System') <trace interval in minutes>(defaults to 30 minutes)"
if [[ "$1" = "-h" ]]; then
echo $usage
exit 0
fi
tracedUserName=${1:-System}
traceInterval=${2:-30}
echo "tracing $tracedUserName for $traceInterval minutes"
@surajp
surajp / Dockerfile
Created September 23, 2022 14:47
VSC Dev Container
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/ubuntu/.devcontainer/base.Dockerfile
# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="jammy"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
@surajp
surajp / retrieveAllPublicReports.sh
Created January 14, 2022 21:04
Bash script to retrieve all public reports in an org
#!/usr/bin/env bash
set -euo pipefail
orgname=$1
sfdx force:data:soql:query -q "Select FolderName,DeveloperName from Report where FolderName='Public Reports'" -u $orgname -r csv | tail -n +2 | grep -e "^[^,]" | sed 's/^/Report:/g' | sed -z 's/,/\//g' | tr '\n' ', ' | sed 's/.$//' | xargs -I '%' sfdx force:source:retrieve -m "%" -u $orgname -w 5
@surajp
surajp / .tidyrc
Created July 6, 2021 19:37
Tidy rc for xml files
input-xml: yes
quiet: yes
indent: yes
indent-attributes: yes
indent-spaces: 4
char-encoding: utf8
wrap: 0
wrap-asp: no
wrap-jste: no
wrap-php: no