Archives

Query Multi-Select Picklists in SOQL

Create list of values to check for multi picklist Query using INCLUDES and using String.join to create string of List. Use , for OR and ; for AND to match values in picklist

Rate this:

Read More

JPA Criteria Query Examples

Get All Accounts Select * from Account where SSN=? Select * from DWLoan where aid=? and chngStatus is not null Count number of rows in Account Table SELECT id,status,created_at from transactions where status=’1′ and currency=’USD’ and appId=’123′ order by id

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

Dynamic SOQL Queries packages and security

For managed packaged development dynamic SOQL queries assist developers with creating soql queries on the fly without hard coding field names which may not be there in all orgs. When you install an managed package you may run into trouble is some fields do not exist. This is why dynamic SOQL queries can be beneficial by using […]

Rate this:

Read More