9

For example, the email_greeting_display field of the civicrm_contact table is not available as a field in Views. How do I add that to a View?

See also How to include a token in a view?

  • In my opinion, this is one of those ares where there really needs to be some additional documentation and integration built into CiviCRM. This would increase functionality and lower the learning curve dramatically – pmoz Jun 14 '15 at 12:43
4

You will need to add the field manually to:

drupal/modules/views/components/civicrm.core.inc

and then submit a PR to civicrm-drupal repository, so the fix gets merged into the main code base.

In D8, the situation is a lot better, as torrance has automated the process and the fields and their definition get picked up automatically. So a lot cleaner and easier on everyone.

But for now, the above is your best bet and will help views intergration for D7 and prior

4

There are three ways to do this. Lobo detailed one of them, and alluded to work done for D8 to automate this - but similar work has been done for D7 as well.

The other two options each involve installing a module: Either civicrm_entity 2.0, or Views CiviCRM Expose Tables. Views Expose Tables can expose every field in every CiviCRM table. CiviCRM Entity works with fewer tables, but a) it's the ones you probably want, and b) it has applicability beyond Views - e.g. you can use it for Rules integration.

There was an excellent presentation by Mark Hanna from Sqvare at CiviCon Denver 2015: https://denver2015.civicrm.org/sessions/civicrmdrupal-integration-showcase. The video's not up yet, but the PDF of the slides is, and it's well worth reading, not just for Views integration.

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.