Thursday, 24 September 2015

Dynamic telephone number presentation based on Apex Trigger

Introduction

During a recent Computer Telephony Integration (CTI) project with a customer we had a requirement that the outbound (or presented telephone number) should be selected dynamically for each call made using a custom Apex Class.

Luckily, NewVoiceMedia's CTI solution features a hook which allows for a custom Apex Class that would handle this logic and alternate the presented number.

This write up covers the Trigger and Class, stored for prosperity.

Thursday, 17 September 2015

Error message: System.QueryException: Non-selective query against large object type (more than 100000 rows)

Debugging the error message: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.

Also known as - too many rows in your database table and no index fields

During a recent project I kept seeing the error below in the Salesforce Debug log. This was a new error to me so it took a long time to work out why my code was failing. 
System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
Having found the cause of the issue I wanted to write it up to hopefully save anyone else facing this problem some time.