Ask Me A Question or Suggest A Blog Topic

Thank you for visiting the Glyn Talks Salesforce blog!  I'm excited to be sharing my experience and expertise with the Salesforce development community.  Use this blog post to ask me questions or suggest a blog topic.  Add your comment below.
About Me I've been working with Salesforce as a Developer and Architect since 2012.  For most of that time, I've worked for consulting partners of various sizes.  I'm currently with Slalom as a Solution Principal.  The title doesn't indicate this, but my day-to-day job is to work on client projects as a Technical Architect and Technical Lead, and to work with prospective clients creating technical documents for proposals and estimating team size, team composition, and project duration (all together, Level of Effort estimates).  I manage and mentor several developers, and I created the curriculum for and ran the Salesforce Academy for our Boston Cross Market Salesforce practice (with help - Thank you, Tom, Michael & Andrew!…

Dependent Picklist Values in Apex - A Concise Solution

I don't want to read the explanation - just take me to the code!
The Problem Salesforce supports the concept of a "dependent" picklist, that is, a picklist whose values vary based on the state of another field (the "controlling" field).  According to Salesforce Help:

A dependent picklist is a custom or multi-select picklist for which the valid values depend on the value of another field, called the controlling field. Controlling fields can be any picklist (with at least one and fewer than 300 values) or checkbox field on the same record.
Figure 1 shows a field dependency defined between a controlling picklist field, Control, and the dependent picklist field, Depend.  For each of the possible values of Control (A, B, C, D, E, F, G, H), the columns of the table show in yellow the values of Depend (X, Y, Z) that are valid (or "included").

Figure 2 shows a field dependency defined between a controlling checkbox field, CheckBox, and a dependent picklist fi…