Book Image

Learning Apex Programming

5 (1)
Book Image

Learning Apex Programming

5 (1)

Overview of this book

Table of Contents (17 chapters)
Learning Apex Programming
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

These aren't the queries you're looking for


There are times when you need to store a lot of constants in the database and they aren't related to each other or maybe have nothing to do with accounts, contacts, or any other sObject. Again, we don't want to perform multiple queries and we definitely don't want to hardcode these variables into our Apex classes. Instead, we can leverage an Apex trick called custom settings to get data out of the database without performing a query that counts against our execution governor limits.

Custom settings are similar to other sObjects, but are cached for faster access. You can create custom fields on them, but only on certain field types. The more complex field types such as picklists, long text area fields, formula fields, and so on are not allowed. You can create multiple custom setting sObjects and records, but are limited to a small amount of data compared with your overall data storage limits. Custom setting records are only accessible via the Force...