I'm using the Autocomplete extension and it works as advertised. However, I was hoping someone could help me customize the output of the autocomplete.

I would like to include all of the Organization contact_type entries as well as several subgroups while excluding others.

Below will filter out the contact_sub_types, but also filters out any of the parent Organizations that do not have a subtype. How do I return a display_name for Organizations with no subtype as well as subtypes

global $civicrm_setting;
$civicrm_setting['eu.tttp.publicautocomplete']['params'] = array(
  'contact_type' => 'Organization',
  'contact_sub_type' => array('NOT LIKE' => "Facility\", \"Legislation\", \"Contract"),
  'return' => 'display_name'

Thanks in advance for your help.

  • Can you approach it a different way and select based on group / tag / custom field etc rather than subtype? – Aidan Feb 19 '18 at 9:21
  • Thanks for replying Aidan. I have thought of that and that might be a good work around, but I would still have to update the tags every time someone signs up for an event to make this work and I was hoping to automate the process more. – jansmath3 Feb 20 '18 at 18:05
  • Is there a way to add a null value to the array like global $civicrm_setting; $civicrm_setting['eu.tttp.publicautocomplete']['params'] = array( 'contact_type' => 'Organization', 'contact_sub_type' => array('LEA','School','School_Headquarters'), 'return' => 'display_name' ); – jansmath3 Feb 20 '18 at 20:11
  • contact_sub_type' => array('LEA','School','School_Headquarters'null or '' or 'null'? – jansmath3 Feb 20 '18 at 20:17
  • You can find just those with no subtype using 'contact_sub_type' => array('IS NULL' => 1) but I don't know that the api lets you do what you need. You mention updating when someone signs up for an event - maybe look at smart groups? You might need to expand the question a bit as to how event signups affect the organisations you want to show for autocomplete. – Aidan Feb 21 '18 at 10:03

Your Answer

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

Browse other questions tagged or ask your own question.