Allow grouping by custom field name in addition to id

In 4.1 you could use GroupBy with a custom field name. The current code filters this out.