Primary custom fields support - taken from srbaker commit and fixed

forked from https://github.com/mattbeedle/capsule_crm/pull/24 , and fixed tests