Archives

Apex Dynamic Object Mapping for REST endpoints

Writing rest endpoints in Apex can be hard and exposing Salesforce fields to external application may not make allot of sense as custom fields end with __c and some fields are not writable or systems fields. I have worked on creating a Serializer that could serialize a Salesforce object mapping and translate that back to […]

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