Skip to content

Instantly share code, notes, and snippets.

View szymon-halik's full-sized avatar
🏠
Working from home

Szymon Halik szymon-halik

🏠
Working from home
View GitHub Profile
@brianmfear
brianmfear / Scheduled.apxc
Created March 24, 2016 03:11
Scheduled Execution bug
public class Scheduled implements Schedulable {
@TestVisible static Boolean executed = false;
public void execute(SchedulableContext c) {
executed = true;
}
}
@douglascayers
douglascayers / InvocableApexTemplate.cls
Created January 4, 2018 08:15
Example structure of an invocable apex class
public with sharing class InvocableApexTemplate {
@InvocableMethod(
label = 'Name as displayed in Process Builder'
description = 'Tooltip as displayed in Process Builder'
)
public static List<Response> execute( List<Request> requests ) {
List<Response> responses = new List<Response>();
@msrivastav13
msrivastav13 / generatepkgXML.sh
Created October 12, 2018 04:18
Generates package.xml from the Unmanaged container/Managed Package or Changesets
#!/bin/bash
if [ $# -lt 1 ]
then
echo Usage: generatepkgXML.sh orgalias packageName
exit
fi
## Retrieve the PackageXML from Unmanaged Container
@gdoenlen
gdoenlen / AccountSelector.cls
Last active December 12, 2024 15:51
Simple dependency injection within SFDC
/**
* Selector for the `Account` entity
*/
public class AccountSelector {
public static final AccountSelector INSTANCE = new AccountSelector();
/**
* Finds all accounts that are child accounts of
* the given opportunity's account.
@arufian
arufian / dynamicFields.js
Last active February 25, 2024 22:19
How to use dynamic fields at @wire getRecord - LWC (Lightning Web Component)
import { LightningElement, track, wire, api } from 'lwc';
export default class DynamicFields extends LightningElement {
@api recordId;
@track fields;
@api objectApiName;
@wire(getRecord, { recordId: '$recordId', fields: '$fields' })
record;
{
"objects": [
{
"operation": "Insert",
"externalId": "Id",
"mockFields": [],
"updateWithMockData": false,
"mockCSVData": false,
"deleteOldData": true,
"allRecords": true,
@amitastreait
amitastreait / ContentManager.js
Last active May 20, 2025 13:16
How to preview files in Lightning Community using LWC
import { api, LightningElement, track, wire } from 'lwc';
import getContentDetails from '@salesforce/apex/ContentManagerService.getContentDetails';
import deleteContentDocument from '@salesforce/apex/ContentManagerService.deleteContentDocument';
import getLoginURL from '@salesforce/apex/ContentManagerService.getLoginURL';
import { NavigationMixin } from 'lightning/navigation';
const columns = [
{ label: 'Title', fieldName: 'Title', wrapText : true,
cellAttributes: {
iconName: { fieldName: 'icon' }, iconPosition: 'left'
@rapatil
rapatil / Automating Salesforce Data Extraction Using Python.ipynb
Last active February 25, 2025 14:57
Approach: Automating Salesforce Data Extraction Using Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@banderson5144
banderson5144 / dynamicLookup.html
Created September 19, 2025 02:25
dynamic sObject Lookup with GraphQL
<template>
<!-- https://github.com/pozil/sfdc-ui-lookup-lwc -->
<c-lookup
lwc:ref="sobjLookup"
label="sObject Lookup"
onsearch={handleLookupSearch}
onselectionchange={handleLookupSelectionChange}
></c-lookup>
</template>
@afawcett
afawcett / sfdoc.md
Last active November 4, 2025 09:05
Cursor Command to help Cursor Read Salesforce Docs

Background: I find Cursor struggles to retrieve content from Salesforce documentation links due to various approaches used such as as shadow dom and dynamic loading. This Cursor command leverages Cursors Browser Automation tool (needs to be explcitly enabled) to help give it a few more clues on how to deal with these pages. I initially built a shell script for it to call but then I discovered Cursor commands. So I built this command using Cursor itself once we had both figured this out - effectively it wrote its own instructions. Use at your own risk.

Usage: In Cursor type / and select Create Command enter sfdoc and press enter. Then paste the content below into the file. To use, use prompts like Read this https://developer.salesforce.com/docs... using /sfdoc. Make sure you have chromium NPM library installed globally as the Node.js scripts below require it. Also make sure you have given Cursor permission to use your browser - there is a icon bottom right of the chat window to enable this in