Database failure in Campaigns display

Everything in our installation works fine with the exception of a recurring error, which we would like to fix.

When displaying Campaigns and picking any campaign, we get an error in the display for the Target list and e-mail marketing entry even though these exist and the campaigns run successfully via that campaign wizard.

The error is ‘Database Failure - please refer to suitecrm log for details’. I have seen other posts with similar issues but in different areas of the app.

The log file entries that relate are below;

where prospect_lists.deleted=0) ORDER BY prospect_lists.name asc LIMIT 0,10: MySQL error 1250: Table ‘prospect_lists’ from one of the SELECTs cannot be used in global ORDER clause
Thu Mar 23 10:16:47 2023 [3812][1][FATAL] [ListView::processUnionBeans] . Database failure. Please refer to suitecrm.log for details.
Thu Mar 23 10:16:49 2023 [3812][1][FATAL] Mysqli_query failed.
Thu Mar 23 10:16:49 2023 [3812][1][FATAL] Error retrieving Campaign list: Query Failed: (SELECT prospect_lists.id , prospect_lists.name , prospect_lists.description , prospect_lists.list_type , prospect_lists.assigned_user_id , ‘prospectlists’ panel_name FROM prospect_lists INNER JOIN prospect_list_campaigns ON prospect_lists.id=prospect_list_campaigns.prospect_list_id AND prospect_list_campaigns.campaign_id=‘da418580-3a7c-a7e0-3ad4-6419ea21764e’ AND prospect_list_campaigns.deleted=0

** where prospect_lists.deleted=0) ORDER BY prospect_lists.name desc LIMIT 0,10: MySQL error 1250: Table ‘prospect_lists’ from one of the SELECTs cannot be used in global ORDER clause**
Thu Mar 23 10:16:49 2023 [3812][1][FATAL] [ListView::processUnionBeans] . Database failure. Please refer to suitecrm.log for details.
Thu Mar 23 10:16:53 2023 [3812][1][FATAL] Mysqli_query failed.
Thu Mar 23 10:16:53 2023 [3812][1][FATAL] Error retrieving Campaign list: Query Failed: (SELECT prospect_lists.id , prospect_lists.name , prospect_lists.description , prospect_lists.list_type , prospect_lists.assigned_user_id , ‘prospectlists’ panel_name FROM prospect_lists INNER JOIN prospect_list_campaigns ON prospect_lists.id=prospect_list_campaigns.prospect_list_id AND prospect_list_campaigns.campaign_id=‘da418580-3a7c-a7e0-3ad4-6419ea21764e’ AND prospect_list_campaigns.deleted=0

** where prospect_lists.deleted=0) ORDER BY prospect_lists.list_type asc LIMIT 0,10: MySQL error 1250: Table ‘prospect_lists’ from one of the SELECTs cannot be used in global ORDER clause**
Thu Mar 23 10:16:53 2023 [3812][1][FATAL] [ListView::processUnionBeans] . Database failure. Please refer to suitecrm.log for details.
Thu Mar 23 10:16:57 2023 [3812][1][FATAL] Mysqli_query failed.
Thu Mar 23 10:16:57 2023 [3812][1][FATAL] Error retrieving Campaign list: Query Failed: (SELECT prospect_lists.id , prospect_lists.name , prospect_lists.description , prospect_lists.list_type , prospect_lists.assigned_user_id , ‘prospectlists’ panel_name FROM prospect_lists INNER JOIN prospect_list_campaigns ON prospect_lists.id=prospect_list_campaigns.prospect_list_id AND prospect_list_campaigns.campaign_id=‘da418580-3a7c-a7e0-3ad4-6419ea21764e’ AND prospect_list_campaigns.deleted=0

** where prospect_lists.deleted=0) ORDER BY prospect_lists.name desc LIMIT 0,10: MySQL error 1250: Table ‘prospect_lists’ from one of the SELECTs cannot be used in global ORDER clause**
Thu Mar 23 10:16:57 2023 [3812][1][FATAL] [ListView::processUnionBeans] . Database failure. Please refer to suitecrm.log for details.

This is SuiteCRM v 8.2.3 PHP 7.4.3 Windows based installation on Apache and MySQL v 8.0.31 within WAMP.

Screenshot below.

I don’t want to dive in and start changing code in line with some of the other post suggestions without checking with the community that this will fix the problem.

Thanks for any help in advance.

Is your issue the same as this one?

Please check the browser console for Javascript errors to see if it matches that.

Hi

Thanks for the quick response. I am not sure that it is the same. I can run the Campaign wizard with no problem at all and the emails get sent at the scheduled time etc…

This is when I go into view a Campaign and select any campaign listed, all of which have been successfully executed via the Wizard. even though a target list has been attached etc… in the display I get the database failure as shown in the screen shot and the log entries. It is in the display sub-tables.

It is closer to another post where it was suggested that a change to SugarBean.php may fix the issue but it is restricted only to the Campaign display screen, not anywhere else that I can see.

If it was a MySQL issue, I would expect this everywhere.

As I said, happy to change code if it is recognisable but don’t really want to start changing code at a guess.

I am going to check on the demo to see if it is there as well.

OK - now fixed.

I took a leap of faith and edited the SugarBean.php file with one very simple change suggested in a post where someone had a similar issue in the Projects module.

Around line 930 (it won’t be exactly there but close to) it was suggested to comment out a line relating to the query. The section of code from SugarBean.php is below. I commented out the line in bold, saved and reloaded the app. All now fine. These minor frustrations take a disproportionate time to get sorted but a good look at the other posts has got me there so far.

//Put the query into the final_query
$query = $subquery[‘select’] . " " . $subquery[‘from’] . " " . $subquery[‘where’];
if (!$first) {
$query = ’ UNION ALL ( ’ . $query . ’ )';
$final_query_rows .= " UNION ALL ";
} else {
//$query = ‘(’ . $query . ‘)’;
$first = false;

1 Like

I think that was already fixed in 8.2.4, so if you had upgraded I believe it would have been solved.

OK, thank you. Having just got 8.2.3 fully configured and operational, we were keen to have this as a stable production release, which has been very well received by the users. We were therefore keen to get it fully accepted and operational before starting upgrades or any further customisation.

Good to know that the new version addresses this and I am sure we will upgrade in due course.

Great product and thanks to you and everyone for their support thus far.