CiviCRM Data Not Accessible

Created on 24 November 2023, about 1 year ago
Updated 25 April 2024, 8 months ago

Problem/Motivation

In Drupal Views, CiviCRM entities are present, but do data is available.

Steps to reproduce

Create a CiviCRM Contact view and add contact name or other fields and then update preview.
No field data is displayed, including when relationships are added.
In CiviCRM Entity, all entity types are enabled. The sytem is using a single database.
When viewing entity Manage Fields, such as /admin/structure/civicrm-entity/civicrm-contact/fields, No fields are present yet is displayed.

What am I missing? Thanks!

πŸ’¬ Support request
Status

Closed: works as designed

Version

3.5

Component

Miscellaneous

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @lkuttner
  • πŸ‡ΊπŸ‡ΈUnited States markusa

    It is normal not to see any fields here:
    /admin/structure/civicrm-entity/civicrm-contact/fields

    This is the form for adding any Drupal native fields, but there would not be any there when first installing or setting up.

    Do you see contacts listed here?
    /admin/structure/civicrm-entity/civicrm-contact

    Back to your Drupal View.

    Have you tried adding "Display Name" field to the view?

    What "Format" and "Show" values do you have on your View configuration?
    Try "Format" = "Unformatted List" and "Show" = "Fields"

  • Thank you @markusa.
    Yes, contacts are listed at /admin/structure/civicrm-entity/civicrm-contact
    I have tried adding CiviCRM Contact (CiviCRM Entity): Display Name and a few other fields
    The field is set to "Format" = "Unformatted List" and "Show" = "Fields"
    The view access is set to Unrestricted. This is on D9.
    I have used CiviCRM Entiity for many years on D7 with no problem.

  • I just noticed some errors in the log: Drupal\Core\Database\DatabaseAccessDeniedException: SQLSTATE[HY000] [1045] Access denied
    I do have 'CIVICRM_DSN', 'mysql://user:pw@localhost:3306/prod?new_link=true' defined in my civicrm.settings.php
    I am wondering if the $ in the pw as %24 is possibly an issue.

  • πŸ‡ΊπŸ‡ΈUnited States markusa

    SQLSTATE[HY000] [1045] Access denied
    This would be that the database user does not have access to the CiviCRM tables.

    Yeah, could try changing the password.

  • Yep, that was it. Thank you.

  • Actually, I found that this is only partially resolved. I now get field data, but when I add a relationship, I get a SQL error in the view such as SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'user'@'localhost' for table 'civicrm_contribution': SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "civicrm_contact" "civicrm_contact" LEFT JOIN vnprod.civicrm_contribution "contact_id_civicrm_contact" ON civicrm_contact.id = contact_id_civicrm_contact.contact_id) "subquery"; Array ( ).
    I have both Drupal and CiviCRM in the same database, using the same MySQL account with the typical permissions. I see posts on how to handle dual db systems getting this error, but not with a single db. This is with MySQL 8x.

  • Status changed to Closed: works as designed 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States markusa

    The updated database user / password should be set in the settings.local.php

    $databases['civicrm']['default'] = array (
      'database' => 'database_name',
      'username' => 'database_user',
      'password' => 'database_password',
      'prefix' => '',
      'host' => 'localhost',
      'port' => '3306',
      'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
      'driver' => 'mysql',
    );
    
    
Production build 0.71.5 2024