addValue('name', 'MyContactFields') ->addValue('extends', 'Contact') ->execute() ->first(); CustomField::create(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'Text') ->addValue('data_type', 'String') ->execute(); $contactId = Contact::create(FALSE) ->addValue('first_name', 'Red') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') ->addValue('MyContactFields.FavColor', 'Red') ->execute() ->first()['id']; Contact::update(FALSE) ->addWhere('id', '=', $contactId) ->addValue('first_name', 'Red') ->addValue('last_name', 'Tester') ->addValue('contact_type', 'Individual') ->addValue('MyContactFields.FavColor', 'Blue') ->execute(); $result = CustomValueTable::getEntityValues($contactId, 'Contact'); $this->assertEquals(1, count($result)); $this->assertContains('Blue', $result); } }