Skip to content

Instantly share code, notes, and snippets.

View antimatter01's full-sized avatar
🎯
Focusing

Deep Banerjee antimatter01

🎯
Focusing
View GitHub Profile
@antimatter01
antimatter01 / gist:96249e9497c13fc3e86d5ac3f98c3d3c
Last active January 14, 2026 06:52
SOQL Builder Utility - Apex
/**
* @name : SOQLQueryBuilder
* @description
* Fluent SOQL builder with enum-based operators.
* Safe for managed packages and Apex parser.
* @version 2.0.2
* @since 2026
*/
public with sharing class SOQLQueryBuilder {
@antimatter01
antimatter01 / fetchData
Last active November 5, 2022 07:59
fetch data from field set
public static Map<String,Object> fetchData(String strObjectApiName, String strfieldSetName,
String whereClauseField, String whereClauseFieldValue){
Map<String, Object> dataMap = new Map<String,Object>();
if(String.isNotEmpty(strObjectApiName) && String.isNotEmpty(strfieldSetName)){
SObject sObj = (SObject)(Type.forName('Schema.'+ strObjectApiName).newInstance());
List<Schema.FieldSetMember> fieldsetMemberList =
@antimatter01
antimatter01 / buildSOQL
Created November 5, 2022 07:41
buildSOQL : utility method to dynamically build the query
public static String buildSOQL(String objectAPIName) {
// Retrieving the field names using the object api name
Set<String> fieldNames = getSObjectFields(objectAPIName);
// Building the SOQL query
String query = 'SELECT ';
for(String fieldName : fieldNames) {
public class TransactionService {
/**
* Meat of the TransactionService
*
* 1 - Set/get of transactionId
* 2 - Track visitedIds by scopeKey to avoid recursion
* 3 - Track whether a "context" is enabled or disabled - especially useful for testmethods
to switch of async handling
**/