Aggregate Model group on multiselect field?

  • 1
  • Question
  • Updated 3 years ago
It looks like we can't group an aggregate model on a multiselect field. Any thoughts on the best way around this?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Yup.  Thats a core SOQL limitation that I don't think we can get around. 

The soution is pretty ugly.   Change the multipicklist to a lookup relationship (many to many) and do your aggregation on the junction object.  Data model surgery.  Ouch.. 

The advantage of this is that you will be able to see how many times each unique value is associated with a record,  rather than seeing all the different combinations of values that are put together in the multi-picklist field. 
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Ok. Thanks!