SurveryResponses MySQL error: Unknown column 'account_name'

Hello everyone,

If you navigate to a Survey, below the questions section, it exists the subpanel SurveyResponses. In the Studio there is available the sort columns ‘Account’ and ‘Contact’, where they are referring to ‘account_name’ and ‘contact_name’ fields.

The first thing I’ve noticed is that those values are not filled in the Survey Responses subpanel: I can see Name, Date Modified and the rest of values of my interest, but Account and Contact have no values. If I navigate to detail of the Survey Response, I can see the field Account ID and Contact ID fields filled as expected.

But, in the Survey Response subpanel, if I order by Account or Contact… Database failure. Please refer to suitecrm.log for details. If I check the log I can see:

[ERROR] Unable to find relationship surveyresponses_accounts
[WARN] account for surveyresponses_accounts failed to load
[FATAL] Error retrieving Surveys list: Query Failed: (SELECT surveyresponses.id , surveyresponses.name , surveyresponses.date_modified , surveyresponses.assigned_user_id , 'surveys_surveyresponses' panel_name FROM surveyresponses INNER JOIN surveys surveys_surveyresponses_rel ON surveyresponses.survey_id=surveys_surveyresponses_rel.id AND surveys_surveyresponses_rel.deleted=0 where ( surveyresponses.survey_id='19078857-a99d-164c-2be2-5e9efc1d526e') AND surveyresponses.deleted=0) ORDER BY account_name desc LIMIT 0,10: MySQL error 1054: Unknown column 'account_name' in 'order clause'

The are no columns named ‘account_name’ or ‘contact_name’ in surveryresponses table. I think there is something broken related to the its relationship with Accounts and Contact.

I could reproduce it in a Suite CRM which is running in production and with a local new fresh install.

Any ideas?

Hi,

I’ve had a little look and I’m also able to replicate this on Suite 7.10.23.
I’m not sure exactly where to begin with resolving this, but it seems to me that the query is trying to order by “contact_name”, despite it doing a SELECT on “contact_id”.

If you haven’t already, it would be worth raising it as an issue on the SuiteCRM github page, (if you haven’t already):