Is there a way to set up a search view profile so that it shows the primary phone number for a contact regardless of what type of phone it is? When setting up this profile, I am required to indicate a type of phone. I want to be able to see results that show the primary phone regardless of type. Thanks.

Screenshot from profile settings

We are using version 4.7.24


Ideally, there should be an option with the label -any- in the above select input. But as it is not present, I don't think there is any UI setting to accept all phone type values for the profile field.

Maybe, you can try API to trigger this (Support -> Developer -> API Explorer) OR http://domainname/civicrm/api#explorer.

Select Entity as UFField and action as create and form the API something like -

$result = civicrm_api3('UFField', 'create', array(
  'id' => <uf_field_id>,
  'field_name' => "phone",
  'phone_type_id' => 0,

The first param is the uf_field_id which is the id of the profile field created in your screenshot.

If you don't find the id, you can check by placing your cursor on the Edit link on the field row displayed for your profile. The URL will be shown on the bottom left of your browser. For eg: in the screenshot below 75 is the value of the field id.

enter image description here

  • Nice suggestion - I actually got it to work (i didn't test using the api, but with straight SQL). I configured the profile field to use the primary phone of type home. Then, taking the id of the profile field, I ran update civicrm_uf_field set phone_type_id = NULL where id = 161 and it seems to work. – Jamie May 21 '19 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.