Archives

Apex Logging Using Static Resources

Define the Error messages detail in json format as static resource Define a ResponseCode class to parse the json into a List of ResponseCodes Define a ResponseCode Manager to translate the Codes into a map to get by id Catch exceptions and log exceptions to logging provide

Rate this:

Read More

Static and dynamic SOQL queries and best practices

If you are building Dynamic SOQL Queries that can be using for Apex Classes and Batch Apex you can use the Database.query(”) function to build the query: private static final String soqlQuery = ‘Select id, OwnerId from Account’; public void updateAccountOwnerByOwnerName(String currentOwnerName, String newOwnerName) { Map<Account> updateAccountWithNewOwnerName = new Map(); List<Account> accountsAssignedToCurrentOwner = Database.query(soqlQuery + […]

Rate this:

Read More